Skip to content

Use OTel's semantic convention constants when we bump minimum OTel version #13287

@alevenberg

Description

@alevenberg

In the async batch publish, we create a root span using the string instead of the constant, since it does not exist in the oldest deps.

https://github.com/googleapis/google-cloud-cpp/pull/13285/files#diff-3e8aefbb8885925f3b6c48b310f1fe9e031aa24315c084fa04cfc13ea5bd86f6R63-R66

Current:

opentelemetry::context::Context root_context;
  // TODO(https://github.com/googleapis/google-cloud-cpp/issues/13287): Use the constant instead of the string.
  root_context.SetValue(/*opentelemetry::trace::kIsRootSpanKey=*/"is_root_span", true);
  options.parent = root_context;

Suggestion:

  root_context =
      root_context.SetValue(opentelemetry::trace::kIsRootSpanKey, true);
  options.parent = root_context;

  • /*sc::kNetworkTransport=*/"network.transport"
  • /*sc::kHttpRequestMethod=*/"http.request.method"
  • /*sc::kUrlFull=*/"url.full"
  • /*sc::kServerAddress=*/"server.address"
  • /*sc::kServerPort=*/"server.port"
  • /*sc::kClientAddress=*/"client.address"
  • /*sc::kClientPort=*/"client.port"

Metadata

Metadata

Assignees

No one assigned

    Labels

    next major: breaking changethis is a change that we should wait to bundle into the next major versiontype: cleanupAn internal cleanup or hygiene concern.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions