-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Port spanmetrics processor to spanmetrics connector #18535
Merged
djaglowski
merged 2 commits into
open-telemetry:main
from
djaglowski:spanmetricsconnector-unified
Feb 14, 2023
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Port spanmetrics processor to spanmetrics connector
- Loading branch information
commit 44c9eb8f03e63b889adbe46ab3d54a4b7b5fffb9
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: new_component | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: spanmetricsconnector | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Add preliminary implementation as a connector. | ||
|
||
# One or more tracking issues related to the change | ||
issues: [18535] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | ||
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../Makefile.Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,107 @@ | ||||||
# Span Metrics Processor | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
| Status | | | ||||||
|------------------------- |---------------------------------------------------------- | | ||||||
| Stability | [development] | | ||||||
| Supported pipeline types | See [Supported Pipeline Types](#supported-pipeline-types) | | ||||||
| Distributions | [] | | ||||||
|
||||||
## Supported Pipeline Types | ||||||
|
||||||
| [Exporter Pipeline Type] | [Receiver Pipeline Type] | | ||||||
| ------------------------ | ------------------------ | | ||||||
| traces | metrics | | ||||||
|
||||||
## Overview | ||||||
|
||||||
Aggregates Request, Error and Duration (R.E.D) metrics from span data. | ||||||
|
||||||
**Request** counts are computed as the number of spans seen per unique set of dimensions, including Errors. | ||||||
For example, the following metric shows 142 calls: | ||||||
``` | ||||||
calls_total{http_method="GET",http_status_code="200",operation="/Address",service_name="shippingservice",span_kind="SPAN_KIND_SERVER",status_code="STATUS_CODE_UNSET"} 142 | ||||||
``` | ||||||
Multiple metrics can be aggregated if, for instance, a user wishes to view call counts just on `service_name` and `operation`. | ||||||
|
||||||
**Error** counts are computed from the Request counts which have an "Error" Status Code metric dimension. | ||||||
For example, the following metric indicates 220 errors: | ||||||
``` | ||||||
calls_total{http_method="GET",http_status_code="503",operation="/checkout",service_name="frontend",span_kind="SPAN_KIND_CLIENT",status_code="STATUS_CODE_ERROR"} 220 | ||||||
``` | ||||||
|
||||||
**Duration** is computed from the difference between the span start and end times and inserted into the | ||||||
relevant latency histogram time bucket for each unique set dimensions. | ||||||
For example, the following latency buckets indicate the vast majority of spans (9K) have a 100ms latency: | ||||||
``` | ||||||
latency_bucket{http_method="GET",http_status_code="200",label1="value1",operation="/Address",service_name="shippingservice",span_kind="SPAN_KIND_SERVER",status_code="STATUS_CODE_UNSET",le="2"} 327 | ||||||
latency_bucket{http_method="GET",http_status_code="200",label1="value1",operation="/Address",service_name="shippingservice",span_kind="SPAN_KIND_SERVER",status_code="STATUS_CODE_UNSET",le="6"} 751 | ||||||
latency_bucket{http_method="GET",http_status_code="200",label1="value1",operation="/Address",service_name="shippingservice",span_kind="SPAN_KIND_SERVER",status_code="STATUS_CODE_UNSET",le="10"} 1195 | ||||||
latency_bucket{http_method="GET",http_status_code="200",label1="value1",operation="/Address",service_name="shippingservice",span_kind="SPAN_KIND_SERVER",status_code="STATUS_CODE_UNSET",le="100"} 10180 | ||||||
latency_bucket{http_method="GET",http_status_code="200",label1="value1",operation="/Address",service_name="shippingservice",span_kind="SPAN_KIND_SERVER",status_code="STATUS_CODE_UNSET",le="250"} 10180 | ||||||
... | ||||||
``` | ||||||
|
||||||
Each metric will have _at least_ the following dimensions because they are common across all spans: | ||||||
- Service name | ||||||
- Operation | ||||||
- Span kind | ||||||
- Status code | ||||||
|
||||||
The following settings can be optionally configured: | ||||||
|
||||||
- `latency_histogram_buckets`: the list of durations defining the latency histogram buckets. | ||||||
- 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 or | ||||||
resource attributes (AKA process tags) such as `ip`, `host.name` or `region`. | ||||||
|
||||||
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. | ||||||
- `dimensions_cache_size`: the max items number of `metric_key_to_dimensions_cache`. If not provided, will | ||||||
use default value size `1000`. | ||||||
- `aggregation_temporality`: Defines the aggregation temporality of the generated metrics. | ||||||
One of either `AGGREGATION_TEMPORALITY_CUMULATIVE` or `AGGREGATION_TEMPORALITY_DELTA`. | ||||||
- Default: `AGGREGATION_TEMPORALITY_CUMULATIVE` | ||||||
|
||||||
## Examples | ||||||
|
||||||
The following is a simple example usage of the spanmetrics connector. | ||||||
|
||||||
For configuration examples on other use cases, please refer to [More Examples](#more-examples). | ||||||
|
||||||
The full list of settings exposed for this connector are documented [here](../../processor/spanmetricsprocessor/config.go). | ||||||
|
||||||
```yaml | ||||||
receivers: | ||||||
nop: | ||||||
|
||||||
exporters: | ||||||
nop: | ||||||
|
||||||
connector: | ||||||
spanmetrics: | ||||||
latency_histogram_buckets: [100us, 1ms, 2ms, 6ms, 10ms, 100ms, 250ms] | ||||||
dimensions: | ||||||
- name: http.method | ||||||
default: GET | ||||||
- name: http.status_code | ||||||
dimensions_cache_size: 1000 | ||||||
aggregation_temporality: "AGGREGATION_TEMPORALITY_CUMULATIVE" | ||||||
|
||||||
service: | ||||||
pipelines: | ||||||
traces: | ||||||
receivers: [nop] | ||||||
exporters: [spanmetrics] | ||||||
metrics: | ||||||
receivers: [spanmetrics] | ||||||
exporters: [nop] | ||||||
``` | ||||||
|
||||||
### More Examples | ||||||
|
||||||
For more example configuration covering various other use cases, please visit the [testdata directory](../../processor/spanmetricsprocessor/testdata). | ||||||
|
||||||
[development]: https://github.com/open-telemetry/opentelemetry-collector#development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http:https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package spanmetricsconnector // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector" | ||
|
||
import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanmetricsprocessor" | ||
|
||
var NewFactory = spanmetricsprocessor.NewConnectorFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
module github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector | ||
|
||
go 1.19 | ||
|
||
require github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanmetricsprocessor v0.71.0 | ||
|
||
require ( | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/hashicorp/golang-lru v0.5.4 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/knadh/koanf v1.5.0 // indirect | ||
github.com/mitchellh/copystructure v1.2.0 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/mitchellh/reflectwalk v1.0.2 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.71.0 // indirect | ||
github.com/tilinna/clock v1.1.0 // indirect | ||
go.opentelemetry.io/collector v0.71.0 // indirect | ||
go.opentelemetry.io/collector/component v0.71.0 // indirect | ||
go.opentelemetry.io/collector/confmap v0.71.0 // indirect | ||
go.opentelemetry.io/collector/consumer v0.71.0 // indirect | ||
go.opentelemetry.io/collector/featuregate v0.71.0 // indirect | ||
go.opentelemetry.io/collector/pdata v1.0.0-rc5 // indirect | ||
go.opentelemetry.io/collector/semconv v0.71.0 // indirect | ||
go.opentelemetry.io/otel v1.13.0 // indirect | ||
go.opentelemetry.io/otel/metric v0.36.0 // indirect | ||
go.opentelemetry.io/otel/trace v1.13.0 // indirect | ||
go.uber.org/atomic v1.10.0 // indirect | ||
go.uber.org/multierr v1.9.0 // indirect | ||
go.uber.org/zap v1.24.0 // indirect | ||
golang.org/x/net v0.5.0 // indirect | ||
golang.org/x/sys v0.4.0 // indirect | ||
golang.org/x/text v0.6.0 // indirect | ||
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect | ||
google.golang.org/grpc v1.52.3 // indirect | ||
google.golang.org/protobuf v1.28.1 // indirect | ||
) | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite => ../../pkg/translator/prometheusremotewrite | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter => ../../exporter/prometheusremotewriteexporter | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal => ../../internal/coreinternal | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus => ../../pkg/translator/prometheus | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger => ../../pkg/translator/jaeger | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver => ../../receiver/jaegerreceiver | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver => ../../receiver/prometheusreceiver | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter => ../../exporter/jaegerexporter | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanmetricsprocessor => ../../processor/spanmetricsprocessor | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => ../../internal/common | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry => ../../pkg/resourcetotelemetry | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter => ../../exporter/prometheusexporter | ||
|
||
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil => ../../pkg/pdatautil |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.