Repository navigation
Closed
Description
Hey! Was just testing the tool, not sure if my expectations are incorrect or I've configured something incorrectly, but my spans don't appear to contain any attributes for the arguments passed to the command being executed, for example:
export OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4317
otel-cli exec --service "otel-cli" --name "echo" --attrs test.attr=abc -- echo "a" "b" "test"
a b testAnd in a locally running otel-collector-contrib with debug logs enabled:
otel-collector-1 | 2024-03-30T16:39:11.684Z info TracesExporter {"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 1}
otel-collector-1 | 2024-03-30T16:39:11.684Z info ResourceSpans #0
otel-collector-1 | Resource SchemaURL: https://opentelemetry.io/schemas/1.17.0
otel-collector-1 | Resource attributes:
otel-collector-1 | -> service.name: Str(otel-cli)
otel-collector-1 | ScopeSpans #0
otel-collector-1 | ScopeSpans SchemaURL: https://opentelemetry.io/schemas/1.17.0
otel-collector-1 | InstrumentationScope github.com/equinix-labs/otel-cli unknown
otel-collector-1 | Span #0
otel-collector-1 | Trace ID : 1ff0a8598155a3557e3a5e1cc7cc85b7
otel-collector-1 | Parent ID :
otel-collector-1 | ID : a1b90937c0f99e17
otel-collector-1 | Name : echo
otel-collector-1 | Kind : Client
otel-collector-1 | Start time : 2024-03-30 16:39:11.675027667 +0000 UTC
otel-collector-1 | End time : 2024-03-30 16:39:11.676319855 +0000 UTC
otel-collector-1 | Status code : Unset
otel-collector-1 | Status message :
otel-collector-1 | Attributes:
otel-collector-1 | -> test.attr: Str(abc)
otel-collector-1 | {"kind": "exporter", "data_type": "traces", "name": "debug"}
otel-collector-1 | 2024-03-30T16:39:11.686Z info zapgrpc/zapgrpc.go:178 [transport] [server-transport 0xc00076d1e0] Closing: EOF {"grpc_log": true}
otel-collector-1 | 2024-03-30T16:39:11.686Z info zapgrpc/zapgrpc.go:178 [transport] [server-transport 0xc00076d1e0] loopyWriter exiting with error: connection error: desc = "transport is closing" {"grpc_log": true}Which only seems to contain the manually specified attribute (and will contains no attributes at all without it).
Is this expected?
No --version to share, but I installed it today with:
go install github.com/equinix-labs/otel-cli@latestMetadata
Metadata 4023
Assignees
Labels
No labels
Activity
tobert commentedon Mar 31, 2024
Looks like it's there?
Is that not where you expect to see them?
I will double check the test suite in the morning to make sure there is good coverage. If it's not working right and/or there is a testing gap I will fix it right away.
tobert commentedon Apr 1, 2024
Looks like --attrs is effectively integration tested, but could use a couple dedicated tests in case I missed something:
otel-cli/data_for_test.go
Line 677 in c3f7dc6
otel-cli/data_for_test.go
Line 703 in c3f7dc6
otel-cli/data_for_test.go
Line 786 in c3f7dc6
tbrockman commentedon Apr 1, 2024
@tobert Okay so it seems like my expectation was wrong? I assumed that in my example above that with
-- echo "a" "b" "test"the CLI would automatically add"a","b", and"test"as span attributes, something like:add a fully-loaded CLI test
tobert commentedon Apr 1, 2024
Yeah, it should be sending
commandandarguments(as CSV) attributes per https://github.com/equinix-labs/otel-cli/blob/c3f7dc6e92ff1a9896a845c14ad510f48afd84ea/otelcli/exec.go#L112C1-L113C1That might not be tested right now. Will add coverage and see what's up.
The attributes & format should also get updated to match semconv. That at least calls for a minor version IMO. First I'll make sure what's there works as expected, then change the names with a minor release.
tobert commentedon Apr 1, 2024
OK, those attributes haven't worked in a while, so I'll fix up the semconv along with the testing & code.
Thanks for the bug report!
miscellaneous cleanups (#317)
fix exec span attrs
fix exec span attrs (#316) (#318)
tobert commentedon Apr 1, 2024
I've released 0.4.5 to fix both sending attributes and aligning with the semantics spec.
There's a specific regression test for this issue: https://github.com/equinix-labs/otel-cli/blob/main/data_for_test.go#L552
Release: https://github.com/equinix-labs/otel-cli/releases/tag/v0.4.5
tbrockman commentedon Apr 1, 2024
Thanks for the quick turn-around! Glad I took the time to bring it up 😬
tobert commentedon Apr 2, 2024
Please let me know if you run into any more trouble and thanks again for the report and dialogue!