Skip to content

[load-generator] Update locustfile for logging with TraceContext#2265

Merged
julianocosta89 merged 9 commits intoopen-telemetry:mainfrom
ps48:load-gen-logging-update
Jun 24, 2025
Merged

[load-generator] Update locustfile for logging with TraceContext#2265
julianocosta89 merged 9 commits intoopen-telemetry:mainfrom
ps48:load-gen-logging-update

Conversation

@ps48
Copy link
Copy Markdown
Contributor

@ps48 ps48 commented Jun 16, 2025

Changes

  • Added LoggingInstrumentor: This is an addition that automatically injects trace context (trace_id, span_id) into all log records.
  • Reorganized initialization order: Moved the tracer provider before the logger provider to ensure trace context is available.
  • Added consistent Resource: Used the same resource across all telemetry signals for better correlation.
  • Wrapped tasks in spans: Each task method now creates a span, which provides trace context for any logs within that span.
  • Added explicit logging: Added log statements within spans so you can see the trace context in action.
  • Added span attributes: Added relevant attributes to spans for better observability.

Related issue: #2250

Merge Requirements

For new features contributions, please make sure you have completed the following
essential items:

  • CHANGELOG.md updated to document new feature additions
  • Appropriate documentation updates in the docs
  • Appropriate Helm chart updates in the helm-charts

Maintainers will not merge until the above have been completed. If you're unsure
which docs need to be changed ping the
@open-telemetry/demo-approvers.

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>
@ps48 ps48 changed the title Update locustfile for logging with traceContext Update locustfile for logging with TraceContext Jun 16, 2025
Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>
@ps48 ps48 marked this pull request as ready for review June 16, 2025 16:10
@ps48 ps48 requested a review from a team as a code owner June 16, 2025 16:10
@ps48 ps48 changed the title Update locustfile for logging with TraceContext [load-generator] Update locustfile for logging with TraceContext Jun 16, 2025
Copy link
Copy Markdown
Member

@julianocosta89 julianocosta89 left a comment

Choose a reason for hiding this comment

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

Hey @ps48 thanks for taking care of that.

I've left some comments, basically to remove the resource and rely on the service name coming from the env var, and asking to keep just one log entry per call.

Just to not explode the amount of data produced by the load-gen.

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>
@ps48
Copy link
Copy Markdown
Contributor Author

ps48 commented Jun 18, 2025

Hi @julianocosta89, this commit db6f18a should address all the mentioned changes.

ps48 and others added 3 commits June 23, 2025 14:46
Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
@julianocosta89 julianocosta89 merged commit 94ad656 into open-telemetry:main Jun 24, 2025
31 checks passed
orkhanM pushed a commit to crashoverride-poc/opentelemetry-demo that referenced this pull request Jun 24, 2025
…n-telemetry#2265)

* update locustfile for logging with traceContext

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* update changelog, lint check

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* remove explicitly adding service name, remove double logging

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* Update src/load-generator/locustfile.py

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>

* Update src/load-generator/locustfile.py

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>

---------

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>
Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
@julianocosta89
Copy link
Copy Markdown
Member

@ps48, we may need to revisit this.

With this change all spans from each task from load-gen are grouped into one single trace:
image

I've missed that in the review, as I was just looking at the logs.

rnjn pushed a commit to base-14/opentelemetry-demo that referenced this pull request Jul 28, 2025
…n-telemetry#2265)

* update locustfile for logging with traceContext

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* update changelog, lint check

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* remove explicitly adding service name, remove double logging

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* Update src/load-generator/locustfile.py

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>

* Update src/load-generator/locustfile.py

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>

---------

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>
Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
cloud-hb pushed a commit to cloud-hb/opentelemetry-demo that referenced this pull request Nov 17, 2025
…n-telemetry#2265)

* update locustfile for logging with traceContext

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* update changelog, lint check

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* remove explicitly adding service name, remove double logging

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* Update src/load-generator/locustfile.py

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>

* Update src/load-generator/locustfile.py

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>

---------

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>
Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
irfn pushed a commit to base-14/opentelemetry-demo that referenced this pull request Jan 13, 2026
…n-telemetry#2265)

* update locustfile for logging with traceContext

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* update changelog, lint check

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* remove explicitly adding service name, remove double logging

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>

* Update src/load-generator/locustfile.py

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>

* Update src/load-generator/locustfile.py

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>

---------

Signed-off-by: Shenoy Pratik <pshenoy36@gmail.com>
Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants