-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add OpenTelemetry support for node-server-sdk. (#401)
- Loading branch information
1 parent
d120bec
commit 485d635
Showing
22 changed files
with
636 additions
and
7 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
.github/ISSUE_TEMPLATE/package-stores-node-server-sdk-otel--bug_report.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: '@launchdarkly/node-server-sdk-otel Bug Report' | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: 'package: telemetry/node-server-sdk-otel, bug' | ||
assignees: '' | ||
--- | ||
|
||
**Is this a support request?** | ||
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the code in this library. If you're not sure whether the problem you are having is specifically related to this library, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/) and clicking "submit a request", or by emailing [email protected]. | ||
|
||
Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above. | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To reproduce** | ||
Steps to reproduce the behavior. | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Logs** | ||
If applicable, add any log output related to your problem. | ||
|
||
**SDK version** | ||
The version of this SDK that you are using. | ||
|
||
**Language version, developer tools** | ||
For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too. | ||
|
||
**OS/platform** | ||
For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. If your code is running in a browser, please also include the browser type and version. | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
19 changes: 19 additions & 0 deletions
19
.github/ISSUE_TEMPLATE/package-stores-node-server-sdk-otel--feature_request.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: '@launchdarkly/node-server-sdk-otel Feature Request' | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: 'package: telemetry/node-server-sdk-otel, feature' | ||
assignees: '' | ||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: telemetry/node-server-sdk-otel | ||
|
||
on: | ||
push: | ||
branches: [main, 'feat/**'] | ||
paths-ignore: | ||
- '**.md' #Do not need to run CI for markdown changes. | ||
pull_request: | ||
branches: [main, 'feat/**'] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
build-test-node-server-otel: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: 'https://registry.npmjs.org' | ||
- id: shared | ||
name: Shared CI Steps | ||
uses: ./actions/ci | ||
with: | ||
workspace_name: '@launchdarkly/node-server-sdk-otel' | ||
workspace_path: packages/telemetry/node-server-sdk-otel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2024 Catamorphic, Co. | ||
|
||
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 | ||
|
||
http://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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# LaunchDarkly Server-Side SDK for Node.js - OpenTelemetry integration | ||
|
||
[![NPM][node-otel-npm-badge]][node-otel-npm-link] | ||
[![Actions Status][node-otel-ci-badge]][node-otel-ci] | ||
[![Documentation](https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8)](https://launchdarkly.github.io/js-core/packages/telemetry/node-server-sdk-otel/docs/) | ||
|
||
## LaunchDarkly overview | ||
|
||
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today! | ||
|
||
[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly) | ||
|
||
## Supported Node versions | ||
|
||
This package is compatible with Node.js versions 14 and above. | ||
|
||
## Quick setup | ||
|
||
This assumes that you have already installed the LaunchDarkly Node.js SDK. | ||
|
||
1. Install this package with `npm` or `yarn`: | ||
|
||
```shell | ||
npm install @launchdarkly/node-server-sdk-otel --save | ||
``` | ||
|
||
2. If your application does not already have its' own dependency on the `@opentelemetry/api` package, add `@opentelemetry/api` as well: | ||
|
||
```shell | ||
npm install @opentelemetry/api --save | ||
``` | ||
|
||
3. Import the tracing hook: | ||
|
||
```typescript | ||
import { TracingHook } from '@launchdarkly/node-server-sdk-otel'; | ||
``` | ||
|
||
4. When configuring your SDK client, add the `TracingHook` | ||
|
||
```typescript | ||
import { init } from '@launchdarkly/node-server-sdk'; | ||
|
||
const client = init('YOUR SDK KEY', {hooks: [new TracingHook()]}); | ||
``` | ||
|
||
## Contributing | ||
|
||
We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this SDK. | ||
|
||
## About LaunchDarkly | ||
|
||
- LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can: | ||
- Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases. | ||
- Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?). | ||
- Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file. | ||
- Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). | ||
- Disable parts of your application to facilitate maintenance, without taking everything offline. | ||
- LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/sdk) for a complete list. | ||
- Explore LaunchDarkly | ||
- [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information | ||
- [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides | ||
- [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation | ||
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates | ||
|
||
[node-otel-ci-badge]: https://github.com/launchdarkly/js-core/actions/workflows/node-otel.yml/badge.svg | ||
[node-otel-ci]: https://github.com/launchdarkly/js-core/actions/workflows/node-otel.yml | ||
[node-otel-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/node-server-sdk-otel.svg?style=flat-square | ||
[node-otel-npm-link]: https://www.npmjs.com/package/@launchdarkly/node-server-sdk-otel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
transform: { '^.+\\.ts?$': 'ts-jest' }, | ||
testMatch: ['**/*.test.ts?(x)'], | ||
testEnvironment: 'node', | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
collectCoverageFrom: ['src/**/*.ts'], | ||
setupFilesAfterEnv: ['@launchdarkly/private-js-mocks/setup'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"name": "@launchdarkly/node-server-sdk-otel", | ||
"version": "0.0.1", | ||
"type": "commonjs", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/telemetry/node-server-sdk-otel", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/launchdarkly/js-core.git" | ||
}, | ||
"description": "OpenTelemetry integration for the LaunchDarkly Server-Side SDK for Node.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"keywords": [ | ||
"launchdarkly", | ||
"analytics", | ||
"client" | ||
], | ||
"scripts": { | ||
"doc": "../../../scripts/build-doc.sh .", | ||
"test": "npx jest --ci", | ||
"build": "npx tsc", | ||
"clean": "npx tsc --build --clean", | ||
"prettier": "prettier --write 'src/*.@(js|ts|tsx|json)'", | ||
"check": "yarn && yarn prettier && yarn lint && tsc && yarn test", | ||
"lint": "npx eslint . --ext .ts" | ||
}, | ||
"license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@launchdarkly/node-server-sdk": "9.2.2", | ||
"@opentelemetry/api": ">=1.3.0" | ||
}, | ||
"devDependencies": { | ||
"@launchdarkly/node-server-sdk": "9.2.2", | ||
"@launchdarkly/private-js-mocks": "0.0.1", | ||
"@opentelemetry/api": ">=1.3.0", | ||
"@opentelemetry/sdk-node": "0.49.1", | ||
"@opentelemetry/sdk-trace-node": "1.22.0", | ||
"@testing-library/dom": "^9.3.1", | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@types/jest": "^29.5.3", | ||
"@types/semver": "^7.5.0", | ||
"@typescript-eslint/eslint-plugin": "^6.20.0", | ||
"@typescript-eslint/parser": "^6.20.0", | ||
"eslint": "^8.45.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-airbnb-typescript": "^17.1.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jest": "^27.6.3", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"jest": "^29.6.1", | ||
"jest-diff": "^29.6.1", | ||
"jest-environment-jsdom": "^29.6.1", | ||
"launchdarkly-js-test-helpers": "^2.2.0", | ||
"prettier": "^3.0.0", | ||
"ts-jest": "^29.1.1", | ||
"typedoc": "0.25.0", | ||
"typescript": "5.1.6" | ||
} | ||
} |
Oops, something went wrong.