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

[Draft] extract resource from spans #1184

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion processor/spanmetricsprocessor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ promexample_latency_bucket{http_method="GET",http_status_code="200",label1="valu
```

Each metric will have _at least_ the following dimensions because they are common across all spans:
- Service name
- Operation
- Span kind
- Status code

Each metric will have _at least_ the following resource attributes because they are common across all spans:
- Service name

This processor lets traces to continue through the pipeline unmodified.

The following settings are required:
Expand All @@ -48,6 +50,8 @@ The following settings can be optionally configured:
- Default: `[2ms, 4ms, 6ms, 8ms, 10ms, 50ms, 100ms, 200ms, 400ms, 800ms, 1s, 1400ms, 2s, 5s, 10s, 15s]`
- `dimensions`: the list of dimensions to add together with the default dimensions defined above. Each additional dimension is defined with a `name` which is looked up in the span's collection of attributes. If the `name`d attribute is missing in the span, the optional provided `default` is used. If no `default` is provided, this dimension will be **omitted** from the metric.

- `resource_attributes`: the list of resource attributes to add together with the default resource attributes defined above. Each additional resource attributes is defined with a `name` which is looked up in the span's collection of resource attributes. If the `name`d resource attribute is missing in the span, the optional provided `default` is used. If no `default` is provided, this resource attribute will be **omitted** from the metric.

## Examples

The following is a simple example usage of the spanmetrics processor.
Expand Down
8 changes: 7 additions & 1 deletion processor/spanmetricsprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ type Config struct {
LatencyHistogramBuckets []time.Duration `mapstructure:"latency_histogram_buckets"`

// Dimensions defines the list of additional dimensions on top of the provided:
// - service.name
// - operation
// - span.kind
// - status.code
// The dimensions will be fetched from the span's attributes. Examples of some conventionally used attributes:
// https://github.com/open-telemetry/opentelemetry-collector/blob/main/translator/conventions/opentelemetry.go.
Dimensions []Dimension `mapstructure:"dimensions"`

// ResourceAttributes defines the list of additional resource attributes to attach to metrics on top of the provided:
// - service.name
// These will be fetched from the span's resource attributes. For more details, see:
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md
// and https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md.
ResourceAttributes []Dimension `mapstructure:"resource_attributes"`
}
Loading