Skip to content

Intercept and collect spans in test runner #14065

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

Merged
merged 6 commits into from
Jun 19, 2025

Conversation

jaydeluca
Copy link
Member

@jaydeluca jaydeluca commented Jun 18, 2025

Related to #13468

Apologies for the large change set, I implemented some ordering to try and make the yaml output deterministic going forward. Future updates should be easier to understand without any random positional drift.

This concludes most of the underlying plumbing needed to gather all the required metadata (at least for this phase of the project). After this is merged, I will continue going through module to module to populate the metadata.yaml data, and enabling and validating the telemetry collection results in batches. I will update the issue with a checklist so we can ensure we hit them all. Once all modules have been validated and rolled out, I can cleanup the span specific feature flag.

Things I changed in this PR:

  • Implemented span interception, which writes temporary span- files into the .telemetry directories
  • Aggregate span data by scope, filter out test attributes
  • Add span information to output, filtering to only data matching the instrumentation module's scope, and presenting sets of attributes by span kind
  • Enabled span collection for clickhouse, dubbo, and akka-http-10.0 as examples
  • Refactor of instrumentation analyzer, broke it down into several classes
  • Made some changes to the yaml writer in order to do some ordering to make things more deterministic

This change will result in new span files being generated in the .telemetry directory, example:

when: default
spans_by_scope:
  - scope: test
    spans:
      - span_kind: CLIENT
        attributes:
      - span_kind: INTERNAL
        attributes:
          - name: test-baggage-key-2
            type: STRING
          - name: test-baggage-key-1
            type: STRING
          - name: test.request.id
            type: LONG
      - span_kind: SERVER
        attributes:
          - name: test.request.id
            type: LONG
  - scope: io.opentelemetry.akka-http-10.0
    spans:
      - span_kind: CLIENT
        attributes:
          - name: url.full
            type: STRING
          - name: server.port
            type: LONG
          - name: http.request.header.x-test-request
            type: STRING_ARRAY
          - name: http.response.status_code
            type: LONG
          - name: http.request.method
            type: STRING
          - name: http.response.header.x-test-response
            type: STRING_ARRAY
          - name: network.protocol.version
            type: STRING
          - name: server.address
            type: STRING
          - name: error.type
            type: STRING
      - span_kind: SERVER
        attributes:
          - name: server.port
            type: LONG
          - name: http.response.status_code
            type: LONG
          - name: http.request.method
            type: STRING
          - name: http.route
            type: STRING
          - name: client.address
            type: STRING
          - name: server.address
            type: STRING
          - name: url.path
            type: STRING
          - name: error.type
            type: STRING
          - name: url.query
            type: STRING
          - name: url.scheme
            type: STRING
          - name: test-baggage-key-2
            type: STRING
          - name: test-baggage-key-1
            type: STRING
          - name: network.protocol.version
            type: STRING
          - name: user_agent.original
            type: STRING

And after we parse, deduplicate, and filter out test related spans and attributes, we see an end result in the instrumentation-yaml file:

- name: akka-http-10.0
  source_path: instrumentation/akka/akka-http-10.0
  ...
  telemetry:
  - when: default
    metrics:
    - name: http.client.request.duration
      description: Duration of HTTP client requests.
      type: HISTOGRAM
      unit: s
      attributes:
      - name: http.request.method
        type: STRING
      ...
    spans:
    - span_kind: CLIENT
      attributes:
      - name: error.type
        type: STRING
      - name: http.request.method
        type: STRING
      - name: http.response.status_code
        type: LONG
      - name: network.protocol.version
        type: STRING
      - name: server.address
        type: STRING
      - name: server.port
        type: LONG
      - name: url.full
        type: STRING
    - span_kind: SERVER
      attributes:
      - name: client.address
        type: STRING
      - name: error.type
        type: STRING
      - name: http.request.method
        type: STRING
      - name: http.response.status_code
        type: LONG
      - name: http.route
        type: STRING
      - name: network.protocol.version
        type: STRING
      - name: server.address
        type: STRING
      - name: server.port
        type: LONG
      - name: url.path
        type: STRING
      - name: url.query
        type: STRING
      - name: url.scheme
        type: STRING
      - name: user_agent.original
        type: STRING

@jaydeluca jaydeluca requested a review from a team as a code owner June 18, 2025 21:39
@jaydeluca jaydeluca mentioned this pull request Jun 18, 2025
24 tasks
@trask trask merged commit a939b59 into open-telemetry:main Jun 19, 2025
89 checks passed
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