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

TraceID and SpanID are both "00000...." in otel log export #6114

Open
seriouspoop opened this issue Dec 24, 2024 · 2 comments
Open

TraceID and SpanID are both "00000...." in otel log export #6114

seriouspoop opened this issue Dec 24, 2024 · 2 comments
Labels
bug Something isn't working response needed Waiting on user input before progress can be made

Comments

@seriouspoop
Copy link

Description

I'm using a otelzap bridge for logging and for testing purposes I've configures a console exporter for both traces and metrics
while logging I manually extract traceID and spanID from the context and add them as zap fields, but when otel exports the logs to console I can see that the traceIDs and spanIDs are added as attributes but the keys TraceID and SpanID are both zeros everytime. I've no idea why is that so.

Environment

  • OS: Fedora 41
  • Architecture: x86
  • Go Version: 1.23.4
  • opentelemetry-go version: whatever is

Expected behavior

Zap Logs:

{

"L": "INFO",

"T": "2024-12-24T11:53:54.758+0530",

"C": "logging/trace.go:36",

"M": "targeting rules retrieved from db",

"service": "delivery-ms",

"TraceID": "564fda5048b0e8651e5f0341008d1240",

"SpanID": "38024b8d30fd704b"

},
{

"L": "DEBUG",

"T": "2024-12-24T11:53:54.758+0530",

"C": "logging/trace.go:29",

"M": "campaign IDs found for the given target",

"service": "delivery-ms",

"TraceID": "564fda5048b0e8651e5f0341008d1240",

"SpanID": "7bacdf0e43bb48a4",

"target": {

"app": "com.abc.xyz",

"country": "germany",

"os": "android"

},

"campaign_ids": [

"d2d29867-3d0b-d497-9191-18a9d8ee7830"

]

} 

Otel Logs:

{

"Timestamp": "2024-12-24T11:53:54.758782459+05:30",

"ObservedTimestamp": "2024-12-24T11:53:54.758836288+05:30",

"Severity": 9,

"SeverityText": "info",

"Body": {

"Type": "String",

"Value": "targeting rules retrieved from db"

},

"Attributes": [

{

"Key": "TraceID",

"Value": {

"Type": "String",

"Value": "564fda5048b0e8651e5f0341008d1240"

}

},

{

"Key": "SpanID",

"Value": {

"Type": "String",

"Value": "38024b8d30fd704b"

}

},

{

"Key": "code.filepath",

"Value": {

"Type": "String",

"Value": "/home/harshit/greedygame/go-common/logging/trace.go"

}

},

{

"Key": "code.lineno",

"Value": {

"Type": "Int64",

"Value": 36

}

},

{

"Key": "code.function",

"Value": {

"Type": "String",

"Value": "Info"

}

},

{

"Key": "code.namespace",

"Value": {

"Type": "String",

"Value": "seriouspoop/greedygame/go-common/logging.(*LoggerWithCtx)"

}

}

],

"TraceID": "00000000000000000000000000000000",

"SpanID": "0000000000000000",

"TraceFlags": "00",

"Resource": [

{

"Key": "service.name",

"Value": {

"Type": "STRING",

"Value": "seriouspoop/greedygame"

}

},

{

"Key": "telemetry.sdk.language",

"Value": {

"Type": "STRING",

"Value": "go"

}

},

{

"Key": "telemetry.sdk.name",

"Value": {

"Type": "STRING",

"Value": "opentelemetry"

}

},

{

"Key": "telemetry.sdk.version",

"Value": {

"Type": "STRING",

"Value": "1.33.0"

}

}

],

"Scope": {

"Name": "seriouspoop/greedygame",

"Version": "",

"SchemaURL": "",

"Attributes": {}

},

"DroppedAttributes": 0

}

{

"Timestamp": "2024-12-24T11:53:54.758901513+05:30",

"ObservedTimestamp": "2024-12-24T11:53:54.758906331+05:30",

"Severity": 5,

"SeverityText": "debug",

"Body": {

"Type": "String",

"Value": "campaign IDs found for the given target"

},

"Attributes": [

{

"Key": "TraceID",

"Value": {

"Type": "String",

"Value": "564fda5048b0e8651e5f0341008d1240"

}

},

{

"Key": "SpanID",

"Value": {

"Type": "String",

"Value": "7bacdf0e43bb48a4"

}

},

{

"Key": "target",

"Value": {

"Type": "Map",

"Value": [

{

"Key": "app",

"Value": {

"Type": "String",

"Value": "com.abc.xyz"

}

},

{

"Key": "country",

"Value": {

"Type": "String",

"Value": "germany"

}

},

{

"Key": "os",

"Value": {

"Type": "String",

"Value": "android"

}

}

]

}

},

{

"Key": "code.filepath",

"Value": {

"Type": "String",

"Value": "/home/harshit/greedygame/go-common/logging/trace.go"

}

},

{

"Key": "code.lineno",

"Value": {

"Type": "Int64",

"Value": 29

}

},

{

"Key": "code.function",

"Value": {

"Type": "String",

"Value": "Debug"

}

},

{

"Key": "code.namespace",

"Value": {

"Type": "String",

"Value": "seriouspoop/greedygame/go-common/logging.(*LoggerWithCtx)"

}

},

{

"Key": "campaign_ids",

"Value": {

"Type": "Slice",

"Value": [

{

"Type": "String",

"Value": "d2d29867-3d0b-d497-9191-18a9d8ee7830"

}

]

}

}

],

"TraceID": "00000000000000000000000000000000",

"SpanID": "0000000000000000",

"TraceFlags": "00",

"Resource": [

{

"Key": "service.name",

"Value": {

"Type": "STRING",

"Value": "seriouspoop/greedygame"

}

},

{

"Key": "telemetry.sdk.language",

"Value": {

"Type": "STRING",

"Value": "go"

}

},

{

"Key": "telemetry.sdk.name",

"Value": {

"Type": "STRING",

"Value": "opentelemetry"

}

},

{

"Key": "telemetry.sdk.version",

"Value": {

"Type": "STRING",

"Value": "1.33.0"

}

}

],

"Scope": {

"Name": "seriouspoop/greedygame",

"Version": "",

"SchemaURL": "",

"Attributes": {}

},

"DroppedAttributes": 0

} 
@seriouspoop seriouspoop added the bug Something isn't working label Dec 24, 2024
@seriouspoop
Copy link
Author

@MrAlias can you please help?

@pellared
Copy link
Member

Missing repro steps

@pellared pellared added the response needed Waiting on user input before progress can be made label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working response needed Waiting on user input before progress can be made
Projects
None yet
Development

No branches or pull requests

2 participants