diff --git a/.yarn/versions/2b13196a.yml b/.yarn/versions/2b13196a.yml new file mode 100644 index 00000000..52acfa3b --- /dev/null +++ b/.yarn/versions/2b13196a.yml @@ -0,0 +1,2 @@ +releases: + solarwinds-apm: patch diff --git a/packages/solarwinds-apm/package.json b/packages/solarwinds-apm/package.json index 51e4d820..250143a7 100644 --- a/packages/solarwinds-apm/package.json +++ b/packages/solarwinds-apm/package.json @@ -77,6 +77,7 @@ "@solarwinds-apm/sampling": "workspace:^", "json-stringify-safe": "^5.0.1", "node-releases": "^2.0.18", + "semver": "^7.6.3", "zod": "^3.23.8" }, "peerDependencies": { diff --git a/packages/solarwinds-apm/src/appoptics/reporter.ts b/packages/solarwinds-apm/src/appoptics/reporter.ts index ce5af5f8..b8cec4f1 100644 --- a/packages/solarwinds-apm/src/appoptics/reporter.ts +++ b/packages/solarwinds-apm/src/appoptics/reporter.ts @@ -30,7 +30,7 @@ import { oboe } from "@solarwinds-apm/bindings" import { type Configuration } from "../config.js" import { componentLogger } from "../logger.js" -import { modules } from "../metadata.js" +import { modules, VERSIONS } from "../metadata.js" import { VERSION } from "../version.js" import certificate from "./certificate.js" @@ -43,7 +43,9 @@ export async function reporter( const reporter = new oboe.Reporter({ service_key: `${config.serviceKey?.token}:${config.service}`, host: config.collector, - certificates: config.trustedpath ?? certificate, + certificates: + config.trustedpath ?? + (config.collector.includes("appoptics.com") ? certificate : ""), grpc_proxy: config.proxy ?? "", reporter: "ssl", metric_format: 1, @@ -67,7 +69,7 @@ export async function reporter( token_bucket_rate: oboe.SETTINGS_UNSET, }) - const logger = componentLogger({ name: "oboe" }) + const logger = componentLogger({ name: "liboboe.so" }) oboe.debug_log_add((level, sourceName, sourceLine, message) => { const log = oboeLevelToOtelLogger(level, logger) @@ -98,6 +100,7 @@ export async function init( ): Promise<[string, string | number | boolean | null][]> { return Object.entries({ ...(await modules()), + ...VERSIONS, ...resource.attributes, __Init: true, diff --git a/packages/solarwinds-apm/src/commonjs/version.js b/packages/solarwinds-apm/src/commonjs/version.js index 3bf9cb0c..7129fe31 100644 --- a/packages/solarwinds-apm/src/commonjs/version.js +++ b/packages/solarwinds-apm/src/commonjs/version.js @@ -48,6 +48,22 @@ try { } } + if (process.versions.ares) { + if ( + process.versions.ares && + process.env.GRPC_DNS_RESOLVER && + process.env.GRPC_DNS_RESOLVER.toLowerCase() === "ares" + ) { + var message = + "The current Node.js version is incompatible with the c-ares gRPC DNS resolver, " + + "which this application explicitly specifies."; + + throw message; + } else { + process.env.GRPC_DNS_RESOLVER = "native"; + } + } + module.exports = true; } catch (error) { console.warn(error); diff --git a/packages/solarwinds-apm/src/exporters/metrics.ts b/packages/solarwinds-apm/src/exporters/metrics.ts index 8011f960..f4f97eb8 100644 --- a/packages/solarwinds-apm/src/exporters/metrics.ts +++ b/packages/solarwinds-apm/src/exporters/metrics.ts @@ -50,8 +50,6 @@ export class MetricExporter extends OTLPMetricExporter { instrumentType: InstrumentType, ): AggregationTemporality { switch (instrumentType) { - case InstrumentType.COUNTER: - case InstrumentType.OBSERVABLE_COUNTER: case InstrumentType.HISTOGRAM: { return AggregationTemporality.DELTA } diff --git a/packages/solarwinds-apm/src/metadata.ts b/packages/solarwinds-apm/src/metadata.ts index f9763af6..319ccda4 100644 --- a/packages/solarwinds-apm/src/metadata.ts +++ b/packages/solarwinds-apm/src/metadata.ts @@ -26,7 +26,7 @@ import semver from "semver" export const VERSIONS: Attributes = Object.fromEntries( Object.entries(process.versions) .filter(([name]) => name !== "node") - .map(([name, version]) => [`node.${name}.version`, version]), + .map(([name, version]) => [`nodejs.${name}.version`, version]), ) /** @@ -36,7 +36,7 @@ export async function modules(): Promise { const modules = await dependencies() return Object.fromEntries( [...modules].map(([name, versions]) => [ - `node.${name}.versions`, + `node_modules.${name}.versions`, [...versions].sort(semver.compare), ]), ) diff --git a/scripts/docker.js b/scripts/docker.js index fb849e87..aa4ffb52 100644 --- a/scripts/docker.js +++ b/scripts/docker.js @@ -39,10 +39,21 @@ if (image === "collector") { } else if (process.argv[3] === "build") { exec(`docker compose -f docker/docker-compose.yml build ${image}`) } else { + require("./env.js") + const env = Object.entries(process.env) + .filter( + ([key]) => + key.startsWith("SW_APM_") || + key.startsWith("OTEL_") || + key.startsWith("AWS_LAMBDA_"), + ) + .map(([k, v]) => `-e ${k}=${v}`) + .join(" ") + // first run yarn install in the context of the container so that platform specific modules get installed // then start a shell session with `|| true` so that if the last ran command in the shell errors node doesn't throw // finally run yarn install back on the host to reset the platform specific modules exec( - `docker compose -f docker/docker-compose.yml run --rm ${image} '(yarn install) && (${shell} || true)'; yarn install`, + `docker compose -f docker/docker-compose.yml run ${env} --rm ${image} '(yarn install) && (${shell} || true)'; yarn install`, ) } diff --git a/yarn.lock b/yarn.lock index cf6fb263..15e28966 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7539,6 +7539,7 @@ __metadata: json-stringify-safe: "npm:^5.0.1" node-releases: "npm:^2.0.18" prettier: "npm:^3.3.3" + semver: "npm:^7.6.3" typescript: "npm:~5.6.3" zod: "npm:^3.23.8" peerDependencies: