Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update docs #147

Merged
merged 1 commit into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,36 @@ npm install @saidsef/tracing-node --save

## Usage

You can set required params via env variables or function:

Env vars:
```
CONTAINER_NAME
NODE_ENV
HOSTNAME
SERVICE_NAME
NAME_SPACE
SERVICE_VERSION
ENDPOINT
```

Function args
```
const { setupTracing } = require('@saidsef/tracing-node');
setupTracing('hostname', 'application_name', 'endpoint');
setupTracing({hostname: 'hostname', serviceName: 'service_name', endpoint: 'endpoint'});
```

```
import { setupTracing } from '@saidsef/tracing-node';
setupTracing('hostname', 'application_name', 'endpoint');
setupTracing({hostname: 'hostname', serviceName: 'service_name', endpoint: 'endpoint'});
```

### Required Parameters are

| Name | Type | Description|
|----- | ---- | ------------- |
| hostname | string | container / pod hostname |
| application_name | string | service / application name |
| service_name | string | service / application name |
| endpoint | string | tracing endpoint i.e. `<schema>://<host>:<port>` |

## Source
Expand Down
2 changes: 1 addition & 1 deletion libs/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function setupTracing (options={}) {

const provider = new NodeTracerProvider({
resource: new Resource({
[SemanticResourceAttributes.CONTAINER_NAME]: containerName,
[SemanticResourceAttributes.CONTAINER_NAME]: containerName || serviceName,
[SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: deploymentEnvironment,
[SemanticResourceAttributes.HOSTNAME]: hostname,
[SemanticResourceAttributes.SERVICE_NAME]: serviceName,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@saidsef/tracing-node",
"version": "2.1.0",
"version": "2.1.1",
"description": "tracing NodeJS - This is a wrapper for OpenTelemetry instrumentation packages",
"main": "libs/index.mjs",
"scripts": {
Expand Down