npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@map-colonies/telemetry

v7.0.1

Published

Package for everything opentelemetry related in map colonies

Downloads

1,222

Readme

Telemetry

Motive

This package goal is to make the experience of configuring and working with OpenTelemetry easier.

Manual for easy local grafana deployment

example

Below are short examples for tracing and metrics. More examples are available at the examples folder, and the various opentelemetry repos.

Tracing

The following code shows a simple example of how to work with tracing. please notice that you need to manually install any auto-instrumentation library that you require.

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

const tracing = new Tracing();

tracing.start();

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

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

span.setAttribute('some-attribute');

// DO STUFF

span.end();

tracing.stop().then(() => console.log('done'));

Another way for initialize tracing with custom resource:

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.

import { Metrics } from '@map-colonies/telemetry';

const metrics = new Metrics('sample-meter');

const meter = metrics.start();

const counter = meter.createCounter('sample_counter');

counter.add(1);

metrics.stop().then(() => console.log('done'));

Semantic Conventions

The package's Semantic Conventions submodule defines a common set of (semantic) attributes which provide meaning to data when collecting, producing and consuming it.

Based on the official OpenTelemetry conventions

Link to full documentation

Configuration

Common configuration

| name |allowed value| default value | description |---|---|---|---| |TELEMETRY_SERVICE_NAME|string|from package.json| The service name |TELEMETRY_SERVICE_VERSION|string| from package.json| The service version |TELEMETRY_HOST_NAME|string|os.hostname()|The host name

Tracing configuration

| name |allowed value| default value | description |---|---|---|---| |TELEMETRY_TRACING_ENABLED|'true', 'false'|'false'|Should Tracing be enabled |TELEMETRY_TRACING_URL*|string|http://localhost:4318/v1/traces|The URL to the OpenTelemetry Collector |TELEMETRY_TRACING_RATIO|float|1|The amount of traces to sample

* required (only when tracing is enabled).

Metric configuration

| name |allowed value| default value | description |---|---|---|---| |TELEMETRY_METRICS_ENABLED|'true', 'false'|'false'|Should Metrics be enabled| |TELEMETRY_METRICS_URL*|string|http://localhost:4318/v1/metrics|The URL to the OpenTelemetry Collector |TELEMETRY_METRICS_INTERVAL|number|15000|The interval in miliseconds between sending data to the collector

* required (only when tracing is enabled).

How to release

Run the command npm run release -- to bump the version in all the files and create a changelog.

For more detailed documentation and examples check: https://github.com/conventional-changelog/standard-version