Skip to content

Commit

Permalink
Merge branch 'main' into dluna/graphql-semconv-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
david-luna committed May 13, 2024
2 parents fa218c0 + 5767ab0 commit 3a3c5bc
Show file tree
Hide file tree
Showing 135 changed files with 3,189 additions and 1,601 deletions.
2 changes: 1 addition & 1 deletion .github/component-label-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pkg:instrumentation-bunyan:
- changed-files:
- any-glob-to-any-file:
- plugins/node/opentelemetry-instrumentation-bunyan/**
pkg:instrumentation-cassandra:
pkg:instrumentation-cassandra-driver:
- changed-files:
- any-glob-to-any-file:
- plugins/node/opentelemetry-instrumentation-cassandra/**
Expand Down
3 changes: 3 additions & 0 deletions .github/component_owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ components:
- pichlermarc
- legendecas
- blumamir
packages/baggage-span-processor:
- mikegoldsmith
- jamiedanielson
packages/opentelemetry-host-metrics:
- legendecas
packages/opentelemetry-id-generator-aws-xray:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ jobs:
# get main again
- name: Checkout Repository
# only checkout if a release has been created
if: ${{ steps.release.outputs.releases_created }}
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Rebuild Packages
# only rebuild if a release has been created
if: ${{ steps.release.outputs.releases_created }}
run: |
npm ci
npm run compile
Expand All @@ -67,6 +71,8 @@ jobs:
# need to publish all unpublished versions to npm here
# See: https://github.com/lerna/lerna/tree/main/commands/publish#bump-from-package
- name: Publish to npm
# only publish if a release has been created
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: npx lerna publish from-package --no-push --no-private --no-git-tag-version --no-verify-access --yes
4 changes: 2 additions & 2 deletions .github/workflows/test-all-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["14", "16", "18.18.2"]
node: ["14", "16", "18"]
runs-on: ubuntu-latest
services:
mongo:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:15-alpine
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_DB: otel_pg_database
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["14", "16", "18.18.2"]
node: ["14", "16", "18"]
include:
- node: 18.18.2
- node: 18
code-coverage: true
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:15-alpine
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_DB: otel_pg_database
Expand Down
25 changes: 13 additions & 12 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"detectors/node/opentelemetry-resource-detector-gcp": "0.29.9",
"detectors/node/opentelemetry-resource-detector-github": "0.28.2",
"detectors/node/opentelemetry-resource-detector-instana": "0.9.0",
"metapackages/auto-instrumentations-node": "0.45.0",
"metapackages/auto-instrumentations-node": "0.46.0",
"metapackages/auto-instrumentations-web": "0.39.0",
"packages/baggage-span-processor": "0.1.0",
"packages/opentelemetry-host-metrics": "0.35.1",
"packages/opentelemetry-id-generator-aws-xray": "1.2.2",
"packages/opentelemetry-propagation-utils": "0.30.9",
Expand All @@ -20,34 +21,34 @@
"plugins/node/instrumentation-dataloader": "0.9.0",
"plugins/node/instrumentation-fs": "0.12.0",
"plugins/node/instrumentation-lru-memoizer": "0.37.0",
"plugins/node/instrumentation-mongoose": "0.38.0",
"plugins/node/instrumentation-mongoose": "0.38.1",
"plugins/node/instrumentation-runtime-node": "0.4.0",
"plugins/node/instrumentation-socket.io": "0.39.0",
"plugins/node/instrumentation-tedious": "0.10.0",
"plugins/node/instrumentation-tedious": "0.10.1",
"plugins/node/instrumentation-undici": "0.2.0",
"plugins/node/opentelemetry-instrumentation-aws-lambda": "0.41.0",
"plugins/node/opentelemetry-instrumentation-aws-sdk": "0.41.0",
"plugins/node/opentelemetry-instrumentation-bunyan": "0.38.0",
"plugins/node/opentelemetry-instrumentation-cassandra": "0.38.0",
"plugins/node/opentelemetry-instrumentation-connect": "0.36.0",
"plugins/node/opentelemetry-instrumentation-dns": "0.36.0",
"plugins/node/opentelemetry-instrumentation-dns": "0.36.1",
"plugins/node/opentelemetry-instrumentation-express": "0.38.0",
"plugins/node/opentelemetry-instrumentation-fastify": "0.36.0",
"plugins/node/opentelemetry-instrumentation-fastify": "0.36.1",
"plugins/node/opentelemetry-instrumentation-generic-pool": "0.36.0",
"plugins/node/opentelemetry-instrumentation-graphql": "0.40.0",
"plugins/node/opentelemetry-instrumentation-hapi": "0.37.0",
"plugins/node/opentelemetry-instrumentation-hapi": "0.38.0",
"plugins/node/opentelemetry-instrumentation-ioredis": "0.40.0",
"plugins/node/opentelemetry-instrumentation-knex": "0.36.0",
"plugins/node/opentelemetry-instrumentation-knex": "0.36.1",
"plugins/node/opentelemetry-instrumentation-koa": "0.40.0",
"plugins/node/opentelemetry-instrumentation-memcached": "0.36.0",
"plugins/node/opentelemetry-instrumentation-mongodb": "0.43.0",
"plugins/node/opentelemetry-instrumentation-mysql": "0.38.0",
"plugins/node/opentelemetry-instrumentation-mysql2": "0.38.0",
"plugins/node/opentelemetry-instrumentation-nestjs-core": "0.37.0",
"plugins/node/opentelemetry-instrumentation-mysql": "0.38.1",
"plugins/node/opentelemetry-instrumentation-mysql2": "0.38.1",
"plugins/node/opentelemetry-instrumentation-nestjs-core": "0.37.1",
"plugins/node/opentelemetry-instrumentation-net": "0.36.0",
"plugins/node/opentelemetry-instrumentation-pg": "0.41.0",
"plugins/node/opentelemetry-instrumentation-pino": "0.38.0",
"plugins/node/opentelemetry-instrumentation-redis": "0.39.0",
"plugins/node/opentelemetry-instrumentation-pino": "0.39.0",
"plugins/node/opentelemetry-instrumentation-redis": "0.39.1",
"plugins/node/opentelemetry-instrumentation-redis-4": "0.39.0",
"plugins/node/opentelemetry-instrumentation-restify": "0.38.0",
"plugins/node/opentelemetry-instrumentation-router": "0.37.0",
Expand Down
33 changes: 33 additions & 0 deletions GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,36 @@ To support this use case, you can choose one of the following options:
};
...
```

## Diag Logging

The OpenTelemetry diagnostic logging channel can be used to troubleshoot issues with instrumentation packages.

### Patching Messages

When OpenTelemetry is installed in a user application, and expected spans are missing from generated traces, it is often useful to differentiate between the following scenarios:

- The instrumentation is not auto loaded - due to issue with the require/import interception, an unsupported version of the instrumented package, or some other issue. This knowledge can pin-point the issue to the instrumentation package.
- The instrumentation patch was applied but expected spans are missing -- this can suggest an issue with instrumented package logic, configuration, limits, otel sdk, or other issues.

It can also be useful to know when the instrumentation is loaded and patched, to understand the order of operations in the application.

Instrumentation packages should use the `@opentelemetry/instrumentation` package `InstrumentationBase` class to register patches and unpatch callbacks for specific require/import of the instrumented package, it's dependency or an internal module file. When this mechanism is used, the base class will automatically emit a debug message on instrumentation diag component logger, looking like this:
```shell
@opentelemetry/instrumentation-foo Applying instrumentation patch for module on require hook {
module: 'foo',
version: '1.2.3',
baseDir: '<your directory>/node_modules/foo'
}
```
Instrumentation should not add additional debug messages for triggering the patching and unpatching callbacks, as the base class will handle this.
Instrumentation may add additional patch/unpatch messages for specific functions if it is expected to help in troubleshooting issues with the instrumentation. Few examples:
- If the patch logic is conditional, and user can benefit from ensuring the condition is met and the patch happened. `koa` patching logic examine an object and branch between patching it as router vs middleware, which is applied at runtime. `aws-lambda` will abort patching if the environment is not configured properly.
- When the patch is not applied directly on a `moduleExports` object in the `InstrumentationBase` callbacks, but rather from an event in the package, like creating new client instance, registering a listener, etc. `fastify` instrumentation applies a patch when a hook is added to the fastify app instance, which is patched from `moduleExports`.
- In situations where the patch logic is not trivial and it helps to specify patch events in the right context and nuances. `aws-lambda` logs additional properties extracted from the lambda framework and exposes them for troubleshooting.
The cases above are not covered by the base class and offer additional context to the user troubleshooting an issue with the instrumentation.
3 changes: 2 additions & 1 deletion detectors/node/opentelemetry-resource-detector-aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ Populates `container` for containers running on [Amazon ECS](https://aws.amazon.
| cloud.platform | The cloud platform. In this context, it's always "aws_ecs" |
| cloud.provider | The cloud provider. In this context, it's always "aws" |
| cloud.region | Parsed value from the `TaskARN` |
| container.id | Value of from file `/proc/self/cgroup` |
| cloud.resource_id | Value of `ContainerARN` from `ECS_CONTAINER_METADATA_URI_V4/task` request |
| container.id | Value from file `/proc/self/cgroup` |
| container.name | The hostname of the operating system |

### AWS EKS Detector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import {
CLOUDPROVIDERVALUES_AWS,
CLOUDPLATFORMVALUES_AWS_ECS,
} from '@opentelemetry/semantic-conventions';
// Patch until the OpenTelemetry SDK is updated to ship this attribute
import { SemanticResourceAttributes as AdditionalSemanticResourceAttributes } from './SemanticResourceAttributes';
import * as http from 'http';
import * as util from 'util';
import * as fs from 'fs';
Expand Down Expand Up @@ -170,6 +172,7 @@ export class AwsEcsDetector implements Detector {

[SEMRESATTRS_CLOUD_ACCOUNT_ID]: accountId,
[SEMRESATTRS_CLOUD_REGION]: region,
[AdditionalSemanticResourceAttributes.CLOUD_RESOURCE_ID]: containerArn,
};

// The availability zone is not available in all Fargate runtimes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const SemanticResourceAttributes = {
/**
* Cloud provider-specific native identifier of the monitored cloud resource
* (e.g. an ARN on AWS, a fully qualified resource ID on Azure, a full resource
* name on GCP)
*/
CLOUD_RESOURCE_ID: 'cloud.resource_id',
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import {
CLOUDPROVIDERVALUES_AWS,
CLOUDPLATFORMVALUES_AWS_ECS,
} from '@opentelemetry/semantic-conventions';
// Patch until the OpenTelemetry SDK is updated to ship this attribute
import { SemanticResourceAttributes as AdditionalSemanticResourceAttributes } from '../../src/detectors/SemanticResourceAttributes';
import { readFileSync } from 'fs';
import * as os from 'os';
import { join } from 'path';
Expand Down Expand Up @@ -81,6 +83,10 @@ const assertEcsResource = (
resource.attributes[SEMRESATTRS_AWS_ECS_CONTAINER_ARN],
validations.containerArn
);
assert.strictEqual(
resource.attributes[AdditionalSemanticResourceAttributes.CLOUD_RESOURCE_ID],
validations.containerArn
);
if (validations.clusterArn)
assert.strictEqual(
resource.attributes[SEMRESATTRS_AWS_ECS_CLUSTER_ARN],
Expand Down
109 changes: 0 additions & 109 deletions examples/postgres/README.md

This file was deleted.

33 changes: 0 additions & 33 deletions examples/postgres/client.js

This file was deleted.

Binary file removed examples/postgres/images/jaeger.png
Binary file not shown.
Binary file removed examples/postgres/images/zipkin.png
Binary file not shown.
Loading

0 comments on commit 3a3c5bc

Please sign in to comment.