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

Set span name from url.path #54

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions kubernetes/elastic-helm/configmap-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ data:
extensions:
processors:
batch: {}
# Transforming span names for easier identification. See: https://github.com/open-telemetry/opentelemetry-demo/issues/1676
transform:
error_mode: ignore
trace_statements:
- context: span
conditions:
- IsString(attributes["http.url"])
statements:
- merge_maps(attributes, URL(attributes["http.url"]), "upsert")
# This pattern should correctly capture the first one or two segments of a URL and assign them to the short_url named group.
- merge_maps(attributes, ExtractPatterns(attributes["url.path"], "^(?P<short_url>\\/[^\\/]+(\\/[^\\/]+)?)"), "upsert")
- set(name, attributes["short_url"])
resource:
attributes:
- key: deployment.environment
Expand Down Expand Up @@ -70,6 +82,7 @@ data:
- spanmetrics
processors:
- batch
- transform
- resource
receivers:
- otlp
Expand Down
6 changes: 3 additions & 3 deletions src/otelcollector/otelcol-elastic-config-extras.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
processors: [batch,transform, resource]
exporters: [spanmetrics, otlp/elastic]
metrics:
receivers: [otlp, spanmetrics]
processors: [batch]
processors: [batch, resource]
exporters: [otlp/elastic]
logs:
receivers: [otlp]
processors: [batch]
processors: [batch, resource]
exporters: [otlp/elastic]
19 changes: 19 additions & 0 deletions src/otelcollector/otelcol-elastic-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ receivers:
otlp:
protocols:
grpc:
endpoint: ${env:OTEL_COLLECTOR_HOST}:${env:OTEL_COLLECTOR_PORT_GRPC}
http:
endpoint: ${env:OTEL_COLLECTOR_HOST}:${env:OTEL_COLLECTOR_PORT_HTTP}
cors:
allowed_origins:
- "http://*"
Expand All @@ -13,6 +15,23 @@ exporters:

processors:
batch:
# Transforming span names for easier identification. See: https://github.com/open-telemetry/opentelemetry-demo/issues/1676
transform:
error_mode: ignore
trace_statements:
- context: span
conditions:
- IsString(attributes["http.url"])
statements:
- merge_maps(attributes, URL(attributes["http.url"]), "upsert")
# This pattern should correctly capture the first one or two segments of a URL and assign them to the short_url named group.
- merge_maps(attributes, ExtractPatterns(attributes["url.path"], "^(?P<short_url>\\/[^\\/]+(\\/[^\\/]+)?)"), "upsert")
- set(name, attributes["short_url"])
resource:
attributes:
- key: deployment.environment
value: "opentelemetry-demo"
action: upsert

connectors:
spanmetrics:
Loading