Skip to content
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

Add support of instruments in configuration for telemetry #4771

Merged
merged 30 commits into from
Apr 2, 2024
Merged

Conversation

bnjjj
Copy link
Contributor

@bnjjj bnjjj commented Mar 8, 2024

Add support for custom and standard instruments through the configuration file. You'll be able to add your own custom metrics just using the configuration file. It can be conditional, get values from selectors like headers, context, body. And the metrics can have different types like histogram or counter.

Example:

telemetry:
  instrumentation:
    instruments:
      router:
        http.server.active_requests: true
        acme.request.duration:
          value: duration
          type: counter
          unit: kb
          description: "my description"
          attributes:
            http.response.status_code: true
            "my_attribute":
              response_header: "x-my-header"
  
      supergraph:
        acme.graphql.requests:
          value: unit
          type: counter
          unit: count
          description: "supergraph requests"
          
      subgraph:
        acme.graphql.subgraph.errors:
          value: unit
          type: counter
          unit: count
          description: "my description"

Documentation

Fixes #4319


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Tests added and passing3
    • Unit Tests
    • Integration Tests
    • Manual Tests

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

bnjjj added 10 commits February 9, 2024 12:02
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>

This comment has been minimized.

@router-perf
Copy link

router-perf bot commented Mar 8, 2024

CI performance tests

  • reload - Reload test over a long period of time at a constant rate of users
  • events_big_cap_high_rate_callback - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity using callback mode
  • events_without_dedup_callback - Stress test for events with a lot of users and deduplication DISABLED using callback mode
  • large-request - Stress test with a 1 MB request payload
  • const - Basic stress test that runs with a constant number of users
  • no-graphos - Basic stress test, no GraphOS.
  • step-jemalloc-tuning - Clone of the basic stress test for jemalloc tuning
  • events - Stress test for events with a lot of users and deduplication ENABLED
  • events_callback - Stress test for events with a lot of users and deduplication ENABLED in callback mode
  • events_big_cap_high_rate - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity
  • events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
  • xxlarge-request - Stress test with 100 MB request payload
  • xlarge-request - Stress test with 10 MB request payload
  • step - Basic stress test that steps up the number of users over time

bnjjj added 2 commits March 8, 2024 14:50
Signed-off-by: Benjamin Coenen <[email protected]>
…g and with custom instruments it will be more compliant to use Vec for attributes

Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
@bnjjj bnjjj marked this pull request as ready for review March 25, 2024 09:28
@bnjjj bnjjj requested a review from a team as a code owner March 25, 2024 09:28
@BrynCooke
Copy link
Contributor

One thing that needs to be added are the config metrics in configuration/metrics.rs. It can use the same pattern as we did for spans.

Signed-off-by: Benjamin Coenen <[email protected]>
Copy link
Contributor

@BrynCooke BrynCooke left a comment

Choose a reason for hiding this comment

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

In general this is looking good.

I think that the code very unit testable so would like to see the individual functions tested in each module.

bnjjj added 2 commits March 28, 2024 11:21
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
@BrynCooke
Copy link
Contributor

BrynCooke commented Mar 28, 2024

I think default_attribute_requirement_level is not working quite right. I had a poke around and didn't manage to spot the issue in the code.
Here's my config:

telemetry:
  exporters:
    metrics:
      prometheus:
        enabled: true
  instrumentation:
    instruments:
      default_attribute_requirement_level: recommended
      router:
        http.server.request.duration:
          attributes:
            network.protocol.version: true

I was expecting the recommended attributes to appear on the standard instrument but there are none:
http_server_request_duration_bucket{otel_scope_name="apollo/router",le="0.001"} 0

Note also that the standard attributes do not correlate with the span standard attributes, so if we're sharing logic there then it'll add the wrong attributes.

bnjjj added 2 commits March 29, 2024 11:57
Signed-off-by: Benjamin Coenen <[email protected]>
Signed-off-by: Benjamin Coenen <[email protected]>
.changesets/feat_bnjjj_feat_4319.md Outdated Show resolved Hide resolved
@bnjjj bnjjj enabled auto-merge (squash) April 2, 2024 08:49
@bnjjj bnjjj merged commit 143dccc into dev Apr 2, 2024
13 of 14 checks passed
@bnjjj bnjjj deleted the bnjjj/feat_4319 branch April 2, 2024 09:11
abernix added a commit that referenced this pull request Jun 5, 2024
In theory v1.44.0 was the first version in which this was fixed, but we
don't recommend running that version for the reasons that are already noted
in the CHANGELOG.md.

Therefore, the first version that we recommend using to utilize custom
historgrams is v1.46.0.  This updates the CHANGELOG.md to signal that with a
note and a duplication of the original CHANGELOG entry.

Original Issue: #4543
Initial PR: #4572
Stabilizing PR: #4771
abernix added a commit that referenced this pull request Jun 5, 2024
In theory v1.44.0 was the first version in which this was fixed, but we
don't recommend running that version for the reasons that are already noted
in the CHANGELOG.md.

Therefore, the first version that we recommend using to utilize custom
historgrams is v1.46.0.  This updates the CHANGELOG.md to signal that with a
note and a duplication of the original CHANGELOG entry.

Original Issue: #4543
Initial PR: #4572
Stabilizing PR: #4771
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.

Custom instruments defined by yaml
5 participants