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

[Tempo] Automatic Logging #551

Merged
merged 34 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9cfe6d9
garbage POC, let's goooooooooooOOO!
joe-elliott Apr 13, 2021
aed6b14
Added basic configuration
joe-elliott Apr 14, 2021
09d2464
Added skeleton processor
joe-elliott Apr 14, 2021
6ee0a46
first pass config wiring
joe-elliott Apr 14, 2021
d161788
got things to work?
joe-elliott Apr 14, 2021
71482e5
kinda sorta works
joe-elliott Apr 14, 2021
ebc8aa7
made things work
joe-elliott Apr 14, 2021
1c88fdc
fixed-ish dur. upped loki and grafana
joe-elliott Apr 14, 2021
4dc4805
fixed duration, added svc name, did processes correctly
joe-elliott Apr 14, 2021
0082076
Added tempo
joe-elliott Apr 15, 2021
3ad6059
configurable tags
joe-elliott Apr 20, 2021
bdda148
config
joe-elliott Apr 20, 2021
74b72a2
Addd stopping flag
joe-elliott Apr 20, 2021
f6463d9
Added tests
joe-elliott Apr 20, 2021
7d3dc64
Added configurable stuff
joe-elliott Apr 20, 2021
c974804
Added automatic logging to docs
joe-elliott Apr 20, 2021
e0238ea
added otel config test
joe-elliott Apr 20, 2021
7e018c3
Made tid configurable
joe-elliott Apr 20, 2021
e967715
changelog
joe-elliott Apr 20, 2021
df7002e
Merge branch 'main' into loki-exporter
joe-elliott Apr 20, 2021
2395de8
Removed zero valued defaults
joe-elliott Apr 21, 2021
55d8f4e
Put changelog entry in the proper spot
joe-elliott Apr 21, 2021
c210739
- _processor
joe-elliott Apr 21, 2021
7b6761c
fixed tests
joe-elliott Apr 21, 2021
a8338d5
Added cross config validation
joe-elliott Apr 21, 2021
0370820
review suggestions
joe-elliott Apr 21, 2021
71c8fd5
First pass SendEntry
joe-elliott Apr 21, 2021
a0d6503
lint
joe-elliott Apr 21, 2021
f345a73
Added configurable timeout
joe-elliott Apr 21, 2021
dbcefc8
Addd logging message when bad things happen
joe-elliott Apr 21, 2021
93c3033
Actually check sent :P
joe-elliott Apr 21, 2021
c70d070
review cleanup
joe-elliott Apr 22, 2021
8633639
config updates
joe-elliott Apr 22, 2021
a05e17c
duh
joe-elliott Apr 22, 2021
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
4 changes: 2 additions & 2 deletions cmd/agent/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func NewEntrypoint(logger *util.Logger, cfg *config.Config, reloader Reloader) (
return nil, err
}

ep.tempoTraces, err = tempo.New(prometheus.DefaultRegisterer, cfg.Tempo, cfg.Server.LogLevel.Logrus)
ep.tempoTraces, err = tempo.New(ep.lokiLogs, prometheus.DefaultRegisterer, cfg.Tempo, cfg.Server.LogLevel.Logrus)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -125,7 +125,7 @@ func (ep *Entrypoint) ApplyConfig(cfg config.Config) error {
failed = true
}

if err := ep.tempoTraces.ApplyConfig(cfg.Tempo, cfg.Server.LogLevel.Logrus); err != nil {
if err := ep.tempoTraces.ApplyConfig(ep.lokiLogs, cfg.Tempo, cfg.Server.LogLevel.Logrus); err != nil {
level.Error(ep.log).Log("msg", "failed to update tempo", "err", err)
failed = true
}
Expand Down
15 changes: 15 additions & 0 deletions docs/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,21 @@ remote_write:
[ sending_queue: <otlpexporter.sending_queue> ]
[ retry_on_failure: <otlpexporter.retry_on_failure> ]

# automatically log lines to Loki for discovery/metrics
joe-elliott marked this conversation as resolved.
Show resolved Hide resolved
automatic_logging:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: what enables this? Is it defining automatic_logging in the config or is it providing a value for loki_name? Can we document which?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding automatic_logging will instantiate the processor, but it will fail with an error message if it can't find the provided loki_name.

[ spans: <boolean> | default = false ] # log one line per span. Warning! possibly very high volume
[ roots: <boolean> | default = false ] # log one line for every root span of a trace.
[ processes: <boolean> | default = false ] # log one line for every process
[ span_attributes: <string array> | default = []] # additional span attributes to log
[ process_attributes: <string array> | default = []] # additional process attributes to log
joe-elliott marked this conversation as resolved.
Show resolved Hide resolved
overrides:
[ loki_tag: <string> | default = "tempologging" ]
[ service_key: <string> | default = "svc" ]
[ span_name_key: <string> | default = "span" ]
[ status_key: <string> | default = "status" ]
[ duration_key: <string> | default = "dur" ]
[ trace_id_key: <string> | default = "tid" ]

# Receiver configurations are mapped directly into the OpenTelemetry receivers block.
# At least one receiver is required. Supported receivers: otlp, jaeger, kafka, opencensus and zipkin.
# Documentation for each receiver can be found at https://github.com/open-telemetry/opentelemetry-collector/blob/7d7ae2eb34b5d387627875c498d7f43619f37ee3/receiver/README.md
Expand Down
7 changes: 6 additions & 1 deletion example/docker-compose/agent/config/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ tempo:
key: env
value: prod
remote_write:
- endpoint: otel-collector:55680
- endpoint: tempo:55680
insecure: true
batch:
timeout: 5s
send_batch_size: 100
automatic_logging:
loki_name: default
spans: true
processes: true
roots: true
22 changes: 13 additions & 9 deletions example/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ services:
ports:
- "12345:12345"
depends_on:
- otel-collector
- tempo

loki:
image: grafana/loki:1.5.0
image: grafana/loki:2.2.1
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
Expand Down Expand Up @@ -44,15 +44,19 @@ services:
- agent

# tracing backend
otel-collector:
image: otel/opentelemetry-collector:0.9.0
volumes:
- ./otel-collector:/etc/otel-collector
command:
- --config=/etc/otel-collector/config.yaml
tempo:
joe-elliott marked this conversation as resolved.
Show resolved Hide resolved
image: grafana/tempo:df7225ae
command:
- "-storage.trace.backend=local" # tell tempo where to permanently put traces
- "-storage.trace.local.path=/tmp/tempo/traces"
- "-storage.trace.wal.path=/tmp/tempo/wal" # tell tempo where to store the wal
- "-auth.enabled=false" # disables the requirement for the X-Scope-OrgID header
- "-server.http-listen-port=3200"
ports:
- "3200:3200"

grafana:
image: grafana/grafana:6.6.1
image: grafana/grafana:7.5.4
entrypoint:
- /usr/share/grafana/bin/grafana-server
- --homepath=/usr/share/grafana
Expand Down
17 changes: 17 additions & 0 deletions example/docker-compose/grafana/datasources/datasource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ datasources:
isDefault: false
version: 1
editable: false
- name: Tempo
type: tempo
access: proxy
orgId: 1
url: http://tempo:3200
basicAuth: false
isDefault: false
version: 1
editable: false
apiVersion: 1
uid: tempo
- name: Loki
type: loki
access: proxy
Expand All @@ -22,4 +33,10 @@ datasources:
isDefault: false
version: 1
editable: false
jsonData:
derivedFields:
- datasourceUid: tempo
matcherRegex: tid=(\w+)
name: TraceID
url: $${__value.raw}

1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/go-kit/kit v0.10.0
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.4.3
github.com/golang/snappy v0.0.3 // indirect
github.com/google/dnsmasq_exporter v0.0.0-00010101000000-000000000000
github.com/gorilla/mux v1.8.0
github.com/grafana/loki v1.6.2-0.20210205130758-59a34f9867ce
Expand Down
Loading