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

opentelemetry-metrics-api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentelemetry-metrics-api

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

opentelemetry-metrics-api

The opentelemetry-metrics-api gem is an alpha implementation of the OpenTelemetry Metrics API for Ruby applications. Using opentelemetry-metrics-api, a library or application can code against the OpenTelemetry interfaces to produce metric data.

What is OpenTelemetry?

OpenTelemetry is an open source observability framework, providing a general-purpose API, SDK, and related tools required for the instrumentation of cloud-native software, frameworks, and libraries.

OpenTelemetry provides a single set of APIs, libraries, agents, and collector services to capture distributed traces and metrics from your application. You can analyze them using Prometheus, Jaeger, and other observability tools.

How does this gem fit in?

The opentelemetry-metrics-api gem defines the core OpenTelemetry interfaces in the form of abstract classes and no-op implementations. That is, it defines interfaces and data types sufficient for a library or application to code against to produce telemetry data, but does not actually collect, analyze, or export the data.

To collect and analyze telemetry data, applications should also install a concrete implementation of the API, such as the opentelemetry-metrics-sdk gem. However, libraries that produce telemetry data should depend only on opentelemetry-metrics-api, deferring the choice of concrete implementation to the application developer.

This code is still under development and is not a complete implementation of the Metrics API. Until the code becomes stable, Metrics API functionality will live outside the opentelemetry-api library.

How do I get started?

Install the gem using:

gem install opentelemetry-metrics-api

Or, if you use bundler, include opentelemetry-metrics-api in your Gemfile.

Then, use the OpenTelemetry interfaces to produces traces and other telemetry data. Following is a basic example.

require 'opentelemetry-metrics-api'

# Obtain the current default meter provider
provider = OpenTelemetry.meter_provider

# Create a meter
meter = provider.meter('my_app', '1.0')

# Record a metric
histogram = meter.create_histogram('histogram', unit: 's', description: 'duration in seconds')

# Record a metric.
histogram.record(123, attributes: {'foo' => 'bar'})

For additional examples, see the examples on github.

How can I get involved?

The opentelemetry-metrics-api gem source is on github, along with related gems including opentelemetry-metrics-sdk.

The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in GitHub Discussions or attending our weekly meeting. See the meeting calendar for dates and times. For more information on this and other language SIGs, see the OpenTelemetry community page.

There's still work to be done, to get to a spec-compliant metrics implementation and we'd love to have more folks contributing to the project. Check the repo for issues and PRs labeled with metrics to see what's available.

Feedback

During this experimental stage, we're looking for lots of community feedback about this gem. Please add your comments to Issue #1662.

License

The opentelemetry-api gem is distributed under the Apache 2.0 license. See LICENSE for more information.

FAQs

Package last updated on 25 Feb 2025

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