Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

span connector output readme update #38106

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vikashkumar2020
Copy link

Description

Added output of span metric connector into the readme based on the given example.

Link to tracking issue

Fixes Issue

Testing

Used sample go application to generate the spans. Then below otel config used for get spanmetrics metrics into prometheus.

receivers:
  otlp:
    protocols:
      http:
        endpoint: 0.0.0.0:4318
      grpc:
        endpoint: 0.0.0.0:4317

processors:
  batch:
    timeout: 10s
    send_batch_size: 1000

exporters:
  prometheusremotewrite:
    endpoint: "http://prometheus:9090/api/v1/write"
    tls:
      insecure: true
    target_info:
      enabled: true

  debug:
    verbosity: detailed

connectors:
  spanmetrics:
    histogram:
      explicit:
        buckets: [100us, 1ms, 2ms, 6ms, 10ms, 100ms, 250ms]
    dimensions:
      - name: http.method
        default: GET
      - name: http.status_code
    exemplars:
      enabled: true
    exclude_dimensions: ['status.code']
    dimensions_cache_size: 1000
    aggregation_temporality: "AGGREGATION_TEMPORALITY_CUMULATIVE"
    metrics_flush_interval: 15s
    metrics_expiration: 5m
    events:
      enabled: true
      dimensions:
        - name: exception.type
        - name: exception.message
    resource_metrics_key_attributes:
      - service.name
      - telemetry.sdk.language
      - telemetry.sdk.name

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [spanmetrics]
    metrics:
      receivers: [spanmetrics]
      processors: [batch]
      exporters: [prometheusremotewrite, debug]

  telemetry:
    logs:
      level: debug

Documentation

Updated the readme

@dehaansa
Copy link
Contributor

It's not clear, is this meant to be attached to the example above it? The markdown headers do not make it very clear, and this could use some more descriptive sentences/paragraphs outlining what exactly you're documenting.

@dehaansa dehaansa added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Feb 21, 2025
@vikashkumar2020
Copy link
Author

@dehaansa Addressed the concern changes

Copy link
Contributor

@dehaansa dehaansa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that this addition is valuable in its current form. A much more concise addition of example metrics at the end of each example configuration would likely add the value that the raised issue is seeking.


### Viewing Span Metrics in Prometheus

The Span Metrics Connector in the OpenTelemetry Collector transforms trace span data into aggregated metrics, following the Request, Error, and Duration (R.E.D) methodology. It outputs key metrics such as request counts (calls), error rates (calls{status_code="5xx"}), and latency distributions (duration histograms). These metrics provide a structured view of service performance, enabling real-time monitoring, alerting, and analysis.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads like an AI-generated summary, and doesn't belong in this section.


The Span Metrics Connector in the OpenTelemetry Collector transforms trace span data into aggregated metrics, following the Request, Error, and Duration (R.E.D) methodology. It outputs key metrics such as request counts (calls), error rates (calls{status_code="5xx"}), and latency distributions (duration histograms). These metrics provide a structured view of service performance, enabling real-time monitoring, alerting, and analysis.

You can observe the output from the `spanmetrics` connector in Prometheus by visiting [http://localhost:9090/graph](http://localhost:9090/graph).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes the configuration being used is exporting to prometheus, and that it's a local prometheus. Should this output metrics section belong to one of the examples above instead of being in its own section?


### Available Metrics

When the spanmetrics connector processes traces, it generates several Prometheus-formatted metrics. Each metric provides different insights into your service's behavior and performance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The metrics generated are not prometheus-formatted, they are opentelemetry metrics that in your example are exported to a prometheus endpoint using the exporter.


This counter metric maintains the running sum of all span durations in milliseconds. When combined with the count metric, it allows you to calculate average durations using the formula: `sum/count`.

#### Label Conventions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already listed at the end of the Overview section, and also can be disabled using the exclude_dimensions configuration parameter.

- `status_code`: Shows the operation's result status
- Any additional dimensions configured in your spanmetrics connector

Note: Label names follow Prometheus naming conventions (lowercase with underscores) rather than OpenTelemetry conventions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only true in your example that exports to prometheus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
connector/spanmetrics Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

README for spanmetricsconnector is missing output examples
3 participants