Skip to content

Commit

Permalink
use spanmetrics connector instead of spanmetrics processor
Browse files Browse the repository at this point in the history
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
  • Loading branch information
fatsheep9146 committed Apr 9, 2023
1 parent e5dbaf3 commit 92543a7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 38 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ release.
([#818](https://github.com/open-telemetry/opentelemetry-demo/pull/818))
* Update OTel Collector
([#822](https://github.com/open-telemetry/opentelemetry-demo/pull/822))
* Update OTel Collector to use spanmetrics connector instead of spanmetrics processors
([#829](https://github.com/open-telemetry/opentelemetry-demo/pull/829))

## v0.1.0

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -616,14 +616,14 @@ services:

# OpenTelemetry Collector
otelcol:
image: otel/opentelemetry-collector-contrib:0.74.0
image: otel/opentelemetry-collector-contrib:0.75.0
container_name: otel-col
deploy:
resources:
limits:
memory: 125M
restart: unless-stopped
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ]
command: [ "--feature-gates=service.connectors", "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ]
volumes:
- ./src/otelcollector/otelcol-config.yml:/etc/otelcol-config.yml
- ./src/otelcollector/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(7,histogram_quantile(0.50, sum(rate(latency_bucket{service_name=~\"$service\", operation=~\"$operation\"}[$__rate_interval])) by (le,service_name)))",
"expr": "topk(7,histogram_quantile(0.50, sum(rate(duration_bucket{service_name=~\"$service\", span_name=~\"$span_name\"}[$__rate_interval])) by (le,service_name)))",
"format": "time_series",
"hide": true,
"instant": false,
Expand All @@ -129,7 +129,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(7,histogram_quantile(0.95, sum(rate(latency_bucket{service_name=~\"$service\", operation=~\"$operation\"}[$__range])) by (le,service_name)))",
"expr": "topk(7,histogram_quantile(0.95, sum(rate(duration_bucket{service_name=~\"$service\", span_name=~\"$span_name\"}[$__range])) by (le,service_name)))",
"hide": false,
"instant": true,
"interval": "",
Expand All @@ -144,7 +144,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "histogram_quantile(0.99, sum(rate(latency_bucket{service_name=~\"$service\", operation=~\"$operation\"}[$__rate_interval])) by (le,service_name))",
"expr": "histogram_quantile(0.99, sum(rate(duration_bucket{service_name=~\"$service\", span_name=~\"$span_name\"}[$__rate_interval])) by (le,service_name))",
"hide": true,
"interval": "",
"legendFormat": "quantile99",
Expand All @@ -158,7 +158,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "histogram_quantile(0.999, sum(rate(latency_bucket{service_name=~\"$service\", operation=~\"$operation\"}[$__rate_interval])) by (le,service_name))",
"expr": "histogram_quantile(0.999, sum(rate(duration_bucket{service_name=~\"$service\", span_name=~\"$span_name\"}[$__rate_interval])) by (le,service_name))",
"hide": true,
"interval": "",
"legendFormat": "quantile999",
Expand Down Expand Up @@ -238,7 +238,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(7,sum by (service_name) (rate( calls_total{service_name=~\"$service\", operation=~\"$operation\"}[$__range])))",
"expr": "topk(7,sum by (service_name) (rate(calls{service_name=~\"$service\", span_name=~\"$span_name\"}[$__range])))",
"format": "time_series",
"instant": true,
"interval": "",
Expand Down Expand Up @@ -316,7 +316,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(7,sum(rate( calls_total{status_code=\"STATUS_CODE_ERROR\",service_name=~\"$service\", operation=~\"$operation\"}[$__range])) by (service_name))",
"expr": "topk(7,sum(rate(calls{status_code=\"STATUS_CODE_ERROR\",service_name=~\"$service\", span_name=~\"$span_name\"}[$__range])) by (service_name))",
"instant": true,
"interval": "",
"legendFormat": "{{service_name}}",
Expand Down Expand Up @@ -351,7 +351,7 @@
"refId": "A"
}
],
"title": "Operations Level - Throughput",
"title": "span_names Level - Throughput",
"type": "row"
},
{
Expand Down Expand Up @@ -489,7 +489,7 @@
"uid": "webstore-metrics"
},
"exemplar": false,
"expr": "topk(7, sum(rate(calls_total{service_name=~\"$service\", operation=~\"$operation\"}[$__range])) by (operation,service_name)) ",
"expr": "topk(7, sum(rate(calls{service_name=~\"$service\", span_name=~\"$span_name\"}[$__range])) by (span_name,service_name)) ",
"format": "table",
"instant": true,
"interval": "",
Expand All @@ -502,7 +502,7 @@
"uid": "webstore-metrics"
},
"exemplar": false,
"expr": "topk(7, sum(rate(calls_total{status_code=\"STATUS_CODE_ERROR\",service_name=~\"$service\", operation=~\"$operation\"}[$__range])) by (operation,service_name))",
"expr": "topk(7, sum(rate(calls{status_code=\"STATUS_CODE_ERROR\",service_name=~\"$service\", span_name=~\"$span_name\"}[$__range])) by (span_name,service_name))",
"format": "table",
"hide": false,
"instant": true,
Expand All @@ -511,12 +511,12 @@
"refId": "Error Rate"
}
],
"title": "Top 7 Operations and Errors (APM Table)",
"title": "Top 7 span_names and Errors (APM Table)",
"transformations": [
{
"id": "seriesToColumns",
"options": {
"byField": "operation"
"byField": "span_name"
}
},
{
Expand Down Expand Up @@ -576,13 +576,13 @@
"Rate in Service": 5,
"bRate": 2,
"eRate": 3,
"operation": 0
"span_name": 0
},
"renameByName": {
"Rate in Service": "Service",
"bRate": "Rate",
"eRate": "Error Rate",
"operation": "Operation Name"
"span_name": "span_name Name"
}
}
},
Expand Down Expand Up @@ -624,7 +624,7 @@
"refId": "A"
}
],
"title": "Operation Level - Latencies",
"title": "span_name Level - Latencies",
"type": "row"
},
{
Expand Down Expand Up @@ -696,7 +696,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(7,histogram_quantile(0.50, sum(rate(latency_bucket{service_name=~\"$service\", operation=~\"$operation\"}[$__rate_interval])) by (le,service_name)))",
"expr": "topk(7,histogram_quantile(0.50, sum(rate(duration_bucket{service_name=~\"$service\", span_name=~\"$span_name\"}[$__rate_interval])) by (le,service_name)))",
"format": "time_series",
"hide": true,
"instant": false,
Expand All @@ -712,11 +712,11 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(7,histogram_quantile(0.95, sum(rate(latency_bucket{service_name=~\"$service\", operation=~\"$operation\"}[$__range])) by (le,operation)))",
"expr": "topk(7,histogram_quantile(0.95, sum(rate(duration_bucket{service_name=~\"$service\", span_name=~\"$span_name\"}[$__range])) by (le,span_name)))",
"hide": false,
"instant": true,
"interval": "",
"legendFormat": "{{operation}}",
"legendFormat": "{{span_name}}",
"range": false,
"refId": "B"
},
Expand All @@ -727,7 +727,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "histogram_quantile(0.99, sum(rate(latency_bucket{service_name=~\"$service\", operation=~\"$operation\"}[$__rate_interval])) by (le,service_name))",
"expr": "histogram_quantile(0.99, sum(rate(duration_bucket{service_name=~\"$service\", span_name=~\"$span_name\"}[$__rate_interval])) by (le,service_name))",
"hide": true,
"interval": "",
"legendFormat": "quantile99",
Expand All @@ -741,15 +741,15 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "histogram_quantile(0.999, sum(rate(latency_bucket{service_name=~\"$service\", operation=~\"$operation\"}[$__rate_interval])) by (le,service_name))",
"expr": "histogram_quantile(0.999, sum(rate(duration_bucket{service_name=~\"$service\", span_name=~\"$span_name\"}[$__rate_interval])) by (le,service_name))",
"hide": true,
"interval": "",
"legendFormat": "quantile999",
"range": true,
"refId": "D"
}
],
"title": "Top 3x3 - Operation Latency - quantile95",
"title": "Top 3x3 - span_name Latency - quantile95",
"type": "gauge"
},
{
Expand Down Expand Up @@ -812,10 +812,10 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(7, sum by (operation,service_name)(increase(latency_sum{service_name=~\"${service}\", operation=~\"$operation\"}[5m]) / increase(latency_count{service_name=~\"${service}\",operation=~\"$operation\"}[5m\n])))",
"expr": "topk(7, sum by (span_name,service_name)(increase(duration_sum{service_name=~\"${service}\", span_name=~\"$span_name\"}[5m]) / increase(duration_count{service_name=~\"${service}\",span_name=~\"$span_name\"}[5m\n])))",
"instant": true,
"interval": "",
"legendFormat": "{{operation}} [{{service_name}}]",
"legendFormat": "{{span_name}} [{{service_name}}]",
"range": false,
"refId": "A"
}
Expand Down Expand Up @@ -916,10 +916,10 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "topk(7,sum by (operation,service_name)(increase(latency_sum{service_name=~\"$service\", operation=~\"$operation\"}[$__rate_interval]) / increase(latency_count{service_name=~\"$service\", operation=~\"$operation\"}[$__rate_interval])))",
"expr": "topk(7,sum by (span_name,service_name)(increase(duration_sum{service_name=~\"$service\", span_name=~\"$span_name\"}[$__rate_interval]) / increase(duration_count{service_name=~\"$service\", span_name=~\"$span_name\"}[$__rate_interval])))",
"instant": false,
"interval": "",
"legendFormat": "[{{service_name}}] {{operation}}",
"legendFormat": "[{{service_name}}] {{span_name}}",
"range": true,
"refId": "A"
}
Expand All @@ -945,14 +945,14 @@
"type": "prometheus",
"uid": "webstore-metrics"
},
"definition": "query_result(count by (service_name)(count_over_time(calls_total[$__range])))",
"definition": "query_result(count by (service_name)(count_over_time(calls[$__range])))",
"hide": 0,
"includeAll": true,
"multi": true,
"name": "service",
"options": [],
"query": {
"query": "query_result(count by (service_name)(count_over_time(calls_total[$__range])))",
"query": "query_result(count by (service_name)(count_over_time(calls[$__range])))",
"refId": "StandardVariableQuery"
},
"refresh": 2,
Expand All @@ -972,18 +972,18 @@
"type": "prometheus",
"uid": "webstore-metrics"
},
"definition": "query_result(sum ({__name__=~\".*calls_total\",service_name=~\"$service\"}) by (operation))",
"definition": "query_result(sum ({__name__=~\".*calls\",service_name=~\"$service\"}) by (span_name))",
"hide": 0,
"includeAll": true,
"multi": true,
"name": "operation",
"name": "span_name",
"options": [],
"query": {
"query": "query_result(sum ({__name__=~\".*calls_total\",service_name=~\"$service\"}) by (operation))",
"query": "query_result(sum ({__name__=~\".*calls\",service_name=~\"$service\"}) by (span_name))",
"refId": "StandardVariableQuery"
},
"refresh": 2,
"regex": "/.*operation=\"(.*)\".*/",
"regex": "/.*span_name=\"(.*)\".*/",
"skipUrlSync": false,
"sort": 0,
"type": "query"
Expand Down
13 changes: 7 additions & 6 deletions src/otelcollector/otelcol-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ exporters:
resource_to_telemetry_conversion:
enabled: true
enable_open_metrics: true

processors:
batch:
spanmetrics:
metrics_exporter: prometheus
# temporary measure until description is fixed in .NET
transform:
metric_statements:
- context: metric
Expand All @@ -40,14 +38,17 @@ processors:
metric_names:
- queueSize

connectors:
spanmetrics:

service:
pipelines:
traces:
receivers: [otlp]
processors: [spanmetrics, batch]
exporters: [otlp, logging]
processors: [batch]
exporters: [otlp, logging, spanmetrics]
metrics:
receivers: [otlp]
receivers: [otlp, spanmetrics]
processors: [filter, transform, batch]
exporters: [prometheus, logging]
logs:
Expand Down

0 comments on commit 92543a7

Please sign in to comment.