Skip to content

Commit

Permalink
chore: update docs (#147)
Browse files Browse the repository at this point in the history
Add application required vars
  • Loading branch information
saidsef authored Jun 1, 2024
1 parent ee0a125 commit 63669e9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
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

0 comments on commit 63669e9

Please sign in to comment.