Skip to content

feat: Support mixed categories for semconv opt-in #7274

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

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

prestonvasquez
Copy link
Member

Resolves #7246

Introducing support for category-specific values in the OTEL_SEMCONV_STABILITY_OPT_IN environment variable for otelhttp and otelmongo. For example, multiple categories should be supported without error:

export OTEL_SEMCONV_STABILITY_OPT_IN=http,database,messaging/dup

@github-actions github-actions bot requested a review from dmathieu April 27, 2025 04:30
Copy link

codecov bot commented Apr 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.1%. Comparing base (046b3b6) to head (4963776).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #7274   +/-   ##
=====================================
  Coverage   81.0%   81.1%           
=====================================
  Files        204     204           
  Lines      18095   18188   +93     
=====================================
+ Hits       14672   14762   +90     
- Misses      3003    3005    +2     
- Partials     420     421    +1     
Files with missing lines Coverage Δ
...lei/go-restful/otelrestful/internal/semconv/env.go 94.9% <100.0%> (+0.1%) ⬆️
....com/gin-gonic/gin/otelgin/internal/semconv/env.go 94.9% <100.0%> (+0.1%) ⬆️
...ub.com/gorilla/mux/otelmux/internal/semconv/env.go 93.0% <100.0%> (+0.2%) ⬆️
.../mongo/otelmongo/internal/semconv/event_monitor.go 100.0% <100.0%> (ø)
...tp/httptrace/otelhttptrace/internal/semconv/env.go 90.5% <100.0%> (+0.3%) ⬆️
...entation/net/http/otelhttp/internal/semconv/env.go 90.5% <100.0%> (+0.3%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot requested review from akats7, dashpole and flc1125 April 27, 2025 06:19
@@ -173,7 +173,7 @@ func (s HTTPServer) RecordMetrics(ctx context.Context, md ServerMetricData) {

func NewHTTPServer(meter metric.Meter) HTTPServer {
env := strings.ToLower(os.Getenv(OTelSemConvStabilityOptIn))
duplicate := env == "http/dup"
duplicate := strings.Contains(env, "http/dup")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a nit, but using Contains means writing down http/dupdatabase works. So does http/dup;database.
Should we ensure the string is properly separated by commas? (obviously, this has a performance impact, so I'm also fine saying it doesn't matter).

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I have this issue too. But since it only needs to be executed once, I think the overhead is worth it.

Copy link
Member

Choose a reason for hiding this comment

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

A simple and very strange way: strings.Contains(","env+",", ",http/dup,")

Not for reference or advice.

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.

Instrumentation should assume OTEL_SEMCONV_STABILITY_OPT_IN has a list of values
3 participants