Skip to content

Commit

Permalink
feat(tracing)!: support in resource (#29)
Browse files Browse the repository at this point in the history
* fix(tracing): fix unknown service name

* docs: added initialize with resource
  • Loading branch information
galta95 committed Jul 4, 2021
1 parent 0b87ea5 commit 3df6c71
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 419 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ The following code shows a simple example of how to work with tracing. please no

```typescript
import { Tracing } from '@map-colonies/telemetry';
import { trace } from '@opentelemetry/api';

const tracing = new Tracing('my-tracer-name');
const tracing = new Tracing();

const tracer = tracing.start();
tracing.start();

const tracer = trace.getTracer('tracing-name')

const span = tracer.startSpan('some-action');

Expand All @@ -24,6 +27,18 @@ span.end();
tracing.stop().then(() => console.log('done'));
```

Another way for initialize tracing with custom resource:

```typescript
import { Tracing } from '@map-colonies/telemetry';
import { Resource } from '@opentelemetry/resources';

const resource = new Resource({ 'service.version': number, 'service.name': 'my-service-name' });

const tracing = new Tracing([], resource);
...
```

### Metrics
The following code shows a simple example of how to work with metrics.

Expand Down

0 comments on commit 3df6c71

Please sign in to comment.