Skip to content

Commit

Permalink
Merge branch 'open-telemetry:main' into fix_mongoose_model_method_ses…
Browse files Browse the repository at this point in the history
…sion_instrumentation
  • Loading branch information
ferrelucas committed Mar 15, 2024
2 parents f205174 + 358345f commit 8aa008e
Show file tree
Hide file tree
Showing 95 changed files with 7,807 additions and 1,836 deletions.
12 changes: 10 additions & 2 deletions .github/component_owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ components:
- basti1302
- kirrg001
metapackages/auto-instrumentations-node:
- obecny
- dyladan
- pichlermarc
- legendecas
- blumamir
metapackages/auto-instrumentations-web:
- obecny
- dyladan
- pichlermarc
- legendecas
- blumamir
packages/opentelemetry-host-metrics:
- legendecas
packages/opentelemetry-id-generator-aws-xray:
Expand All @@ -39,6 +45,8 @@ components:
- pichlermarc
- legendecas
- blumamir
packages/winston-transport:
- hectorhdzg
plugins/node/instrumentation-amqplib:
- blumamir
plugins/node/instrumentation-cucumber:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ["14"]
node: ["16"]
runs-on: ubuntu-latest
env:
NPM_CONFIG_UNSAFE_PERM: true
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"detectors/node/opentelemetry-resource-detector-alibaba-cloud":"0.28.7","detectors/node/opentelemetry-resource-detector-aws":"1.4.0","detectors/node/opentelemetry-resource-detector-azure":"0.2.5","detectors/node/opentelemetry-resource-detector-container":"0.3.7","detectors/node/opentelemetry-resource-detector-gcp":"0.29.7","detectors/node/opentelemetry-resource-detector-github":"0.28.1","detectors/node/opentelemetry-resource-detector-instana":"0.7.0","metapackages/auto-instrumentations-node":"0.42.0","metapackages/auto-instrumentations-web":"0.37.0","packages/opentelemetry-host-metrics":"0.35.0","packages/opentelemetry-id-generator-aws-xray":"1.2.1","packages/opentelemetry-propagation-utils":"0.30.7","packages/opentelemetry-redis-common":"0.36.1","packages/opentelemetry-sql-common":"0.40.0","packages/opentelemetry-test-utils":"0.37.0","plugins/node/instrumentation-amqplib":"0.35.0","plugins/node/instrumentation-cucumber":"0.4.0","plugins/node/instrumentation-dataloader":"0.7.0","plugins/node/instrumentation-fs":"0.10.0","plugins/node/instrumentation-lru-memoizer":"0.35.0","plugins/node/instrumentation-mongoose":"0.36.0","plugins/node/instrumentation-runtime-node":"0.2.0","plugins/node/instrumentation-socket.io":"0.37.0","plugins/node/instrumentation-tedious":"0.8.0","plugins/node/opentelemetry-instrumentation-aws-lambda":"0.39.0","plugins/node/opentelemetry-instrumentation-aws-sdk":"0.39.0","plugins/node/opentelemetry-instrumentation-bunyan":"0.36.0","plugins/node/opentelemetry-instrumentation-cassandra":"0.36.0","plugins/node/opentelemetry-instrumentation-connect":"0.34.0","plugins/node/opentelemetry-instrumentation-dns":"0.34.0","plugins/node/opentelemetry-instrumentation-express":"0.36.0","plugins/node/opentelemetry-instrumentation-fastify":"0.34.0","plugins/node/opentelemetry-instrumentation-generic-pool":"0.34.0","plugins/node/opentelemetry-instrumentation-graphql":"0.38.0","plugins/node/opentelemetry-instrumentation-hapi":"0.35.0","plugins/node/opentelemetry-instrumentation-ioredis":"0.38.0","plugins/node/opentelemetry-instrumentation-knex":"0.34.0","plugins/node/opentelemetry-instrumentation-koa":"0.38.0","plugins/node/opentelemetry-instrumentation-memcached":"0.34.0","plugins/node/opentelemetry-instrumentation-mongodb":"0.40.0","plugins/node/opentelemetry-instrumentation-mysql":"0.36.0","plugins/node/opentelemetry-instrumentation-mysql2":"0.36.0","plugins/node/opentelemetry-instrumentation-nestjs-core":"0.35.0","plugins/node/opentelemetry-instrumentation-net":"0.34.0","plugins/node/opentelemetry-instrumentation-pg":"0.39.0","plugins/node/opentelemetry-instrumentation-pino":"0.36.0","plugins/node/opentelemetry-instrumentation-redis":"0.37.0","plugins/node/opentelemetry-instrumentation-redis-4":"0.37.0","plugins/node/opentelemetry-instrumentation-restify":"0.36.0","plugins/node/opentelemetry-instrumentation-router":"0.35.0","plugins/node/opentelemetry-instrumentation-winston":"0.35.0","plugins/web/opentelemetry-instrumentation-document-load":"0.36.0","plugins/web/opentelemetry-instrumentation-long-task":"0.36.0","plugins/web/opentelemetry-instrumentation-user-interaction":"0.36.0","plugins/web/opentelemetry-plugin-react-load":"0.30.0","propagators/opentelemetry-propagator-aws-xray":"1.3.1","propagators/opentelemetry-propagator-grpc-census-binary":"0.27.1","propagators/opentelemetry-propagator-instana":"0.3.1","propagators/opentelemetry-propagator-ot-trace":"0.27.1"}
{"detectors/node/opentelemetry-resource-detector-alibaba-cloud":"0.28.7","detectors/node/opentelemetry-resource-detector-aws":"1.4.0","detectors/node/opentelemetry-resource-detector-azure":"0.2.5","detectors/node/opentelemetry-resource-detector-container":"0.3.7","detectors/node/opentelemetry-resource-detector-gcp":"0.29.7","detectors/node/opentelemetry-resource-detector-github":"0.28.1","detectors/node/opentelemetry-resource-detector-instana":"0.7.0","metapackages/auto-instrumentations-node":"0.43.0","metapackages/auto-instrumentations-web":"0.37.0","packages/opentelemetry-host-metrics":"0.35.0","packages/opentelemetry-id-generator-aws-xray":"1.2.1","packages/opentelemetry-propagation-utils":"0.30.7","packages/opentelemetry-redis-common":"0.36.1","packages/opentelemetry-sql-common":"0.40.0","packages/opentelemetry-test-utils":"0.37.0","packages/winston-transport": "0.1.0","plugins/node/instrumentation-amqplib":"0.35.0","plugins/node/instrumentation-cucumber":"0.4.0","plugins/node/instrumentation-dataloader":"0.7.0","plugins/node/instrumentation-fs":"0.10.0","plugins/node/instrumentation-lru-memoizer":"0.35.0","plugins/node/instrumentation-mongoose":"0.36.0","plugins/node/instrumentation-runtime-node":"0.2.1","plugins/node/instrumentation-socket.io":"0.37.0","plugins/node/instrumentation-tedious":"0.8.0","plugins/node/opentelemetry-instrumentation-aws-lambda":"0.39.0","plugins/node/opentelemetry-instrumentation-aws-sdk":"0.39.1","plugins/node/opentelemetry-instrumentation-bunyan":"0.36.0","plugins/node/opentelemetry-instrumentation-cassandra":"0.36.0","plugins/node/opentelemetry-instrumentation-connect":"0.34.0","plugins/node/opentelemetry-instrumentation-dns":"0.34.0","plugins/node/opentelemetry-instrumentation-express":"0.36.1","plugins/node/opentelemetry-instrumentation-fastify":"0.34.0","plugins/node/opentelemetry-instrumentation-generic-pool":"0.34.0","plugins/node/opentelemetry-instrumentation-graphql":"0.38.1","plugins/node/opentelemetry-instrumentation-hapi":"0.35.0","plugins/node/opentelemetry-instrumentation-ioredis":"0.38.0","plugins/node/opentelemetry-instrumentation-knex":"0.34.0","plugins/node/opentelemetry-instrumentation-koa":"0.38.0","plugins/node/opentelemetry-instrumentation-memcached":"0.34.0","plugins/node/opentelemetry-instrumentation-mongodb":"0.41.0","plugins/node/opentelemetry-instrumentation-mysql":"0.36.0","plugins/node/opentelemetry-instrumentation-mysql2":"0.36.0","plugins/node/opentelemetry-instrumentation-nestjs-core":"0.35.0","plugins/node/opentelemetry-instrumentation-net":"0.34.0","plugins/node/opentelemetry-instrumentation-pg":"0.39.1","plugins/node/opentelemetry-instrumentation-pino":"0.36.0","plugins/node/opentelemetry-instrumentation-redis":"0.37.0","plugins/node/opentelemetry-instrumentation-redis-4":"0.37.0","plugins/node/opentelemetry-instrumentation-restify":"0.36.0","plugins/node/opentelemetry-instrumentation-router":"0.35.0","plugins/node/opentelemetry-instrumentation-winston":"0.35.0","plugins/web/opentelemetry-instrumentation-document-load":"0.36.0","plugins/web/opentelemetry-instrumentation-long-task":"0.36.0","plugins/web/opentelemetry-instrumentation-user-interaction":"0.36.0","plugins/web/opentelemetry-plugin-react-load":"0.30.0","propagators/opentelemetry-propagator-aws-xray":"1.3.1","propagators/opentelemetry-propagator-grpc-census-binary":"0.27.1","propagators/opentelemetry-propagator-instana":"0.3.1","propagators/opentelemetry-propagator-ot-trace":"0.27.1"}
20 changes: 10 additions & 10 deletions GUIDELINES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Instrumentations Implementation Guide

This document captures general guidelines for implementing instrumentations in NodeJS and browser.
This document captures general guidelines for implementing instrumentations in Node.js and browser.

## Types

Expand All @@ -14,11 +14,11 @@ These typescript `interface`s, `type`s, `enum`s and js `const`ants statements SH

#### Exporting

All types from `types.ts` file MUST be exported from instrumentation `index.ts` using export statement `export * from './types'`, which guarentee that they publicly available.
All types from `types.ts` file MUST be exported from instrumentation `index.ts` using export statement `export * from './types'`, which guarantee that they publicly available.

#### Breaking Changes

Since these types are publicly exported, a breaking change in this file can cause transpilation issues or require code changes for existing users. Special care and attention should be put when modifiying this file to guarantee backword compatibility or proper documentation of breaking changes.
Since these types are publicly exported, a breaking change in this file can cause transpilation issues or require code changes for existing users. Special care and attention should be put when modifying this file to guarantee backward compatibility or proper documentation of breaking changes.

### Internal Types

Expand All @@ -30,15 +30,15 @@ It is sometimes convenient to place these declarations in a dedicated file which

The file SHOULD be named `internal-types.ts`.

Using this file is optional - when a type is used only in a single file, it is ok to declare it and use it in this file **without exporting it**. When a type is expected to be shared between multiple files, it is encourged to be declared in `internal-types.ts` to prevent circular dependencies.
Using this file is optional - when a type is used only in a single file, it is ok to declare it and use it in this file **without exporting it**. When a type is expected to be shared between multiple files, it is encouraged to be declared in `internal-types.ts` to prevent circular dependencies.

#### Exporting

This file MUST NOT be exported publicly from instrumentation package, not directly (via `index.ts`) and not transitivly via export of other files.
This file MUST NOT be exported publicly from instrumentation package, not directly (via `index.ts`) and not transitively via export of other files.

#### Changes

Since the declarations in this file are not exported in the public instrumentation api, it is allowed to apply any refactors to this file, and they will not be breaking changes to users.
Since the declarations in this file are not exported in the public instrumentation API, it is allowed to apply any refactors to this file, and they will not be breaking changes to users.

## Dependencies

Expand All @@ -48,7 +48,7 @@ Since instrumentations will install all their dependencies into the end user `no

### OpenTelemetry API

Instrumentation SHOULD NOT add a dependency on `@opentelemetry/api`, as using multiple instrumentations might install multiple api versions into the user node_modules directory. It SHOULD add an entry in `"peerDependencies"` in `package.json` with the **minimum** api version it requires, as caret range (for example: `^1.0.0`).
Instrumentation SHOULD NOT add a dependency on `@opentelemetry/api`, as using multiple instrumentations might install multiple API versions into the user node_modules directory. It SHOULD add an entry in `"peerDependencies"` in `package.json` with the **minimum** API version it requires, as caret range (for example: `^1.0.0`).

Users and distributions need to install a version of `@opentelemetry/api` that is compatible with the instrumentation to use it.

Expand All @@ -64,14 +64,14 @@ Instrumentations SHOULD NOT add a `"dependency"` or `"peerDependencies"` on the

This means that the instrumentation code SHOULD NOT `import` anywhere from the instrumented package. e.g. `@opentelemetry/instrumentation-foo` cannot `import 'foo'` as it will fail for applications that installed the instrumentation but not the `foo` package itself, which is a valid and supported use case for OpenTelemetry distributions and end users.

It is allowed, however, to import `types` from the instrumented package with the [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax, as long as this type is not used in the public api:
It is allowed, however, to import `types` from the instrumented package with the [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) syntax, as long as this type is not used in the public API:

```js
// instrumentation.ts
import type { Bar } from 'foo'; // OK
```

Since the instrumented package is installed as a dev dependency, types are available during compiling. Since they are not part of the public api, typescript removes these imports from the build artifacts during transpilation.
Since the instrumented package is installed as a dev dependency, types are available during compiling. Since they are not part of the public API, typescript removes these imports from the build artifacts during transpilation.

### Types Public API

Expand All @@ -89,7 +89,7 @@ Note that types that are used in non-public files (like `internal-types.ts` or `

### Adding Types in Public API

Sometimes, instrumented package types are needed in an instrumentation's public api. These are mostly found in `types.ts` file on instrumentation config hooks that include data from the package and want to type it for consumers.
Sometimes, instrumented package types are needed in an instrumentation's public API. These are mostly found in `types.ts` file on instrumentation config hooks that include data from the package and want to type it for consumers.

To support this use case, you can choose one of the following options:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

---

# OpenTelemetry Javascript Contrib
# OpenTelemetry JavaScript Contrib

A repository for OpenTelemetry JavaScript contributions that are not part of the [core repository](https://github.com/open-telemetry/opentelemetry-js) and core distribution of the API and the SDK.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ describe('AwsEcsResourceDetector', () => {
process.env.ECS_CONTAINER_METADATA_URI_V4 = ECS_CONTAINER_METADATA_URI_V4;
});

describe('when succesfully retrieving the data', () => {
describe('when successfully retrieving the data', () => {
function generateLaunchTypeTests(
resourceAttributes: EcsResourceAttributes,
suffix = ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ describe('awsEksDetector', () => {
});
});

describe('on unsuccesful request', () => {
describe('on unsuccessful request', () => {
it('should return an empty resource when timed out', async () => {
fileStub = sinon
.stub(AwsEksDetector, 'fileAccessAsync' as any)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const tracerProvider = new NodeTracerProvider({ resource });

## Available detectors

- `containerDetector`: Populates `container.id` for processes running on contianers supporting : docker( cgroup v1 or v2 ) or with containerd
- `containerDetector`: Populates `container.id` for processes running on containers supporting : docker( cgroup v1 or v2 ) or with containerd

## Useful links

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ run()

## Useful links

- [GitHub Action Enviornment Variables](https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables)
- [GitHub Action Environment Variables](https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables)
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class GitHubDetector implements Detector {
* environment variables:
* https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables
*
* If succesful it returns a promise containing a {@link Resource}
* If successful it returns a promise containing a {@link Resource}
* populated with GitHub metadata. Returns a promise containing an
* empty {@link Resource} if the connection fails.
*
Expand Down
2 changes: 1 addition & 1 deletion examples/express/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const authMiddleware: RequestHandler = (req, res, next) => {
app.use(express.json());
app.get('/health', (req, res) => res.status(200).send("HEALTHY")); // endpoint that is called by framework/cluster
app.get('/run_test', async (req, res) => {
// Calls another endpoint of the same API, somewhat mimicing an external API call
// Calls another endpoint of the same API, somewhat mimicking an external API call
const createdCat = await axios.post(`http://localhost:${PORT}/cats`, {
name: 'Tom',
friends: [
Expand Down
2 changes: 1 addition & 1 deletion examples/react-load/preact/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The React Load plugin provides auto-instrumentation for react lifecycle methods.
This example uses the plugin and exports them to the console.

The example will show traces belong to the mounting, updating, and umounting flows as defined by React 16.4+. In this example we can show how this plugin can also be used in a Preact app.
The example will show traces belong to the mounting, updating, and unmounting flows as defined by React 16.4+. In this example we can show how this plugin can also be used in a Preact app.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion examples/react-load/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The React Load plugin provides auto-instrumentation for react lifecycle methods.
This example uses the plugin and exports them to the console.

The example will show traces belong to the mounting, updating, and umounting flows as defined by React 16.4+.
The example will show traces belong to the mounting, updating, and unmounting flows as defined by React 16.4+.

## Installation

Expand Down
18 changes: 18 additions & 0 deletions metapackages/auto-instrumentations-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,24 @@
* dependencies
* @opentelemetry/instrumentation-aws-sdk bumped from ^0.38.0 to ^0.38.1

## [0.43.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/auto-instrumentations-node-v0.42.0...auto-instrumentations-node-v0.43.0) (2024-03-11)


### Features

* **auto-instrumentations-node:** enabling instrumentations via env ([#1953](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1953)) ([0656f37](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/0656f37634e1df71d68cc34cbd210abb6b4776d9))


### Dependencies

* The following workspace dependencies were updated
* dependencies
* @opentelemetry/instrumentation-aws-sdk bumped from ^0.39.0 to ^0.39.1
* @opentelemetry/instrumentation-express bumped from ^0.36.0 to ^0.36.1
* @opentelemetry/instrumentation-graphql bumped from ^0.38.0 to ^0.38.1
* @opentelemetry/instrumentation-mongodb bumped from ^0.40.0 to ^0.41.0
* @opentelemetry/instrumentation-pg bumped from ^0.39.0 to ^0.39.1

## [0.42.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/auto-instrumentations-node-v0.41.1...auto-instrumentations-node-v0.42.0) (2024-03-06)


Expand Down
13 changes: 13 additions & 0 deletions metapackages/auto-instrumentations-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ For example, to enable only the `env`, `host` detectors:
export OTEL_NODE_RESOURCE_DETECTORS="env,host"
```

By default, all [Supported Instrumentations](#supported-instrumentations) are enabled,
but you can use the environment variable `OTEL_NODE_ENABLED_INSTRUMENTATIONS` to enable only certain instrumentations
by providing a comma-separated list of the instrumentation package names without the `@opentelemetry/instrumentation-` prefix.

For example, to enable only
[@opentelemetry/instrumentation-http](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-instrumentation-http)
and [@opentelemetry/instrumentation-nestjs-core](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-nestjs-core)
instrumentations:

```shell
export OTEL_NODE_ENABLED_INSTRUMENTATIONS="http,nestjs-core"
```

To enable logging for troubleshooting, set the log level by setting the `OTEL_LOG_LEVEL` environment variable to one of the following:

- `none`
Expand Down

0 comments on commit 8aa008e

Please sign in to comment.