Skip to content

Conversation

danish9039
Copy link
Contributor

@danish9039 danish9039 commented Jul 16, 2025

Which problem is this PR solving?

Description of the changes

This commit removes the dependency on go.opentelemetry.io/collector/semconv and internalizes the required semantic convention constants.

Key changes:

  • Package internal/telemetry/otelsemconv host the semantic convention constants used throughout the project.

  • All usages of the external semconv package have been replaced with the internal package.

This change reduces external dependencies, providing more stability and control over the semantic conventions used within Jaeger.

How was this change tested?

Checklist

Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.44%. Comparing base (58db762) to head (6b7078f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7318      +/-   ##
==========================================
+ Coverage   96.27%   96.44%   +0.17%     
==========================================
  Files         377      378       +1     
  Lines       22900    22910      +10     
==========================================
+ Hits        22047    22096      +49     
+ Misses        645      616      -29     
+ Partials      208      198      -10     
Flag Coverage Δ
badger_v1 9.16% <0.00%> (-0.01%) ⬇️
badger_v2 1.75% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1-manual 11.90% <0.00%> (-0.02%) ⬇️
cassandra-4.x-v2-auto 1.74% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v2-manual 1.74% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v1-manual 11.90% <0.00%> (-0.02%) ⬇️
cassandra-5.x-v2-auto 1.74% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v2-manual 1.74% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 16.74% <19.23%> (-0.04%) ⬇️
elasticsearch-7.x-v1 16.79% <19.23%> (-0.04%) ⬇️
elasticsearch-8.x-v1 16.95% <19.23%> (-0.04%) ⬇️
elasticsearch-8.x-v2 1.75% <0.00%> (-0.01%) ⬇️
grpc_v1 10.41% <0.00%> (-0.01%) ⬇️
grpc_v2 1.75% <0.00%> (-0.01%) ⬇️
kafka-3.x-v1 9.33% <0.00%> (-0.01%) ⬇️
kafka-3.x-v2 1.75% <0.00%> (-0.01%) ⬇️
memory_v2 1.75% <0.00%> (-0.01%) ⬇️
opensearch-1.x-v1 16.83% <19.23%> (-0.04%) ⬇️
opensearch-2.x-v1 16.83% <19.23%> (-0.04%) ⬇️
opensearch-2.x-v2 1.75% <0.00%> (-0.01%) ⬇️
query 1.75% <0.00%> (-0.01%) ⬇️
tailsampling-processor 0.48% <0.00%> (-0.01%) ⬇️
unittests 95.40% <100.00%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

DBSystemKey = semconv.DBSystemNameKey
PeerServiceKey = semconv.PeerServiceKey
// Service
ServiceNameKey = semconv.ServiceNameKey
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to convert these to strings here so that we don't have to do it all over the code??

Copy link
Contributor Author

@danish9039 danish9039 Jul 17, 2025

Choose a reason for hiding this comment

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

@yurishkuro Because codebase has a mixed usage pattern where semantic convention keys are needed in two different contexts

  1. Internal operations (attribute lookups, map keys, string comparisons) that require string constants
    examples:
  1. OpenTelemetry SDK calls that require attribute.Key types with methods like .String()
    examples:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yurishkuro Should i Modify semconv.go to provide both string constants and attribute.Key types??

something like

const (
    ServiceNameKeyStr = "service.name"
)

var (
    ServiceNameKey = semconv.ServiceNameKey
)
  

Copy link
Member

Choose a reason for hiding this comment

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

how many places where the actual attribute is required? If it's just a couple, I would convert all Key constants to strings but for the places where the actual attribute is being created define functions, e.g.

func ServiceNameAttribute(value strign) {
  return otel.ServiceNameKey.String(svc) 
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yurishkuro got it ! , atrribute keys are used in total of six files, namely :

otelsemconv.PeerServiceKey.String("mysql"),

resource.WithAttributes(otelsemconv.ServiceNameKey.String(svc)),

otelsemconv.DBSystemKey.String("elasticsearch"),

resource.WithAttributes(otelsemconv.ServiceNameKey.String(svc)),

otelsemconv.ServiceNameKey.String("test"),

resource.WithAttributes(otelsemconv.ServiceNameKey.String(serviceName)),

- Update semantic convention attribute access
- Add comprehensive test coverage
- Fix DCO compliance

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
danish9039 and others added 2 commits July 18, 2025 22:55
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
@yurishkuro yurishkuro enabled auto-merge July 18, 2025 19:01
@yurishkuro yurishkuro closed this Jul 19, 2025
auto-merge was automatically disabled July 19, 2025 01:02

Pull request was closed

@yurishkuro yurishkuro reopened this Jul 19, 2025
@yurishkuro yurishkuro enabled auto-merge July 19, 2025 01:03
@yurishkuro yurishkuro disabled auto-merge July 19, 2025 01:30
@yurishkuro yurishkuro merged commit 5a73354 into jaegertracing:main Jul 19, 2025
115 of 118 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace semconv from collector with otel/semconv
2 participants