1+ otelcol.receiver.otlp "default" {
2+ grpc { }
3+
4+ output {
5+ metrics = [
6+ otelcol.processor.transform.add_resource_attributes_as_metric_attributes.input,
7+ ]
8+ traces = [
9+ // This transforms the traces in metrics, we still have to send traces out
10+ otelcol.connector.spanmetrics.asgi_apm.input,
11+ // This also transforms the traces in metrics, we still have to send traces out
12+ otelcol.connector.host_info.default.input,
13+ // This sends the traces out
14+ otelcol.processor.batch.default.input,
15+ ]
16+ logs = [
17+ otelcol.processor.batch.default.input,
18+ ]
19+ }
20+ }
21+
22+ otelcol.connector.host_info "default" {
23+ // https://grafana.com/docs/alloy/latest/reference/components/otelcol.connector.host_info/
24+ host_identifiers = ["host.name"]
25+
26+ output {
27+ metrics = [otelcol.processor.batch.default.input]
28+ }
29+ }
30+
31+ otelcol.connector.spanmetrics "asgi_apm" {
32+ dimension {
33+ name = "http.status_code"
34+ }
35+
36+ dimension {
37+ name = "http.method"
38+ }
39+
40+ dimension {
41+ name = "http.route"
42+ }
43+
44+ histogram {
45+ explicit {
46+ buckets = ["2ms", "4ms", "6ms", "8ms", "10ms", "50ms", "100ms", "200ms", "400ms", "800ms", "1s", "1400ms", "2s", "5s", "10s", "15s"]
47+ }
48+ }
49+
50+ output {
51+ metrics = [otelcol.processor.transform.add_resource_attributes_as_metric_attributes.input]
52+ }
53+ }
54+
55+ otelcol.processor.transform "add_resource_attributes_as_metric_attributes" {
56+ error_mode = "ignore"
57+
58+ metric_statements {
59+ context = "datapoint"
60+ statements = [
61+ "set(attributes[\"deployment.environment\"], resource.attributes[\"deployment.environment\"])",
62+ "set(attributes[\"service.version\"], resource.attributes[\"service.version\"])",
63+ ]
64+ }
65+
66+ output {
67+ metrics = [otelcol.processor.batch.default.input]
68+ }
69+ }
70+
71+ otelcol.processor.batch "default" {
72+ output {
73+ // metrics = [otelcol.exporter.otlphttp.grafanacloud.input]
74+ // logs = [otelcol.exporter.otlphttp.grafanacloud.input]
75+ // traces = [otelcol.exporter.otlphttp.grafanacloud.input]
76+
77+ metrics = [otelcol.exporter.debug.console.input]
78+ logs = [otelcol.exporter.debug.console.input]
79+ traces = [otelcol.exporter.otlp.jaeger.input]
80+ }
81+ }
82+
183otelcol.exporter.otlp "jaeger" {
284 client {
385 endpoint = "jaeger:4317"
@@ -12,18 +94,15 @@ otelcol.exporter.debug "console" {
1294 verbosity = "Detailed"
1395}
1496
15- otelcol.processor.batch "default" {
16- output {
17- traces = [otelcol.exporter.otlp.jaeger.input]
18- }
19- }
2097
21- otelcol.receiver.otlp "default" {
22- grpc { }
98+ otelcol.auth.basic "grafanacloud" {
99+ username = sys.env("GC_USERNAME")
100+ password = sys.env("GC_PASSWORD")
101+ }
23102
24- output {
25- metrics = [otelcol.exporter.debug.console.input]
26- logs = [otelcol.exporter.debug.console.input]
27- traces = [ otelcol.processor.batch.default.input]
28- }
103+ otelcol.exporter.otlphttp "grafanacloud" {
104+ client {
105+ endpoint = sys.env("GC_ENDPOINT")
106+ auth = otelcol.auth.basic.grafanacloud.handler
107+ }
29108}
0 commit comments