New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

opentelemetry-resource-detector-git

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentelemetry-resource-detector-git

open telemetry resource detector for git

  • 0.30.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

OpenTelemetry Service Resource Detector for Node.js

NPM version

This module provides automatic resource detector for Git Version Control System. This resource is not part of open telemetry semantic conventions specification for resources.

The detector is doing best effort to extract git info, including these cases:

  • Git info from common CI environment variables.
  • Docker environment where .git db is present (copied to image or mounted into the container) but git cli is not installed on the image.
  • Docker environment where .git db is missing, but node_modules is copied to image from source environment where .git db was available

Installation

npm install --save opentelemetry-resource-detector-git

Usage

Synchronous SDK Initialization

import { detectSyncResources } from 'opentelemetry-resource-detector-sync-api';
import { gitSyncDetector } from 'opentelemetry-resource-detector-git';

const resource = detectSyncResources({
    detectors: [gitSyncDetector, /* add other sync detectors here */],
});
const tracerProvider = new NodeTracerProvider({ resource });

Asynchronous SDK Initialization

import { detectResources } from '@opentelemetry/resources';
import { gitDetector } from 'opentelemetry-resource-detector-git';

( async () => {
    const resource = await detectResources({
        detectors: [gitDetector, /* add other async detectors here */],
    });
    const tracerProvider = new NodeTracerProvider({ resource });
    // Initialize auto instrumentation plugins and register provider.
    // Make sure you don't 'require' instrumented packages elsewhere 
    // before they are registered here
})();

Attributes

AttributeTypeSource
vcs.systemstringIf this repo is identified as git repo, this attribute will be set to constant value 'git'
vcs.commit.idstring (full SHA-1 object name)sha-1 of the current git HEAD. This value uniquely identifies the git commit of the codebase
vcs.clone.idstring (v4 UUID)Unique id for the clone of the git repo
vcs.branch.namestringname of the current active branch

Keywords

FAQs

Package last updated on 21 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc