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 ability to alias standard attributes for telemetry #5957

Merged
merged 8 commits into from
Sep 6, 2024
Merged

Conversation

bnjjj
Copy link
Contributor

@bnjjj bnjjj commented Sep 4, 2024

There is an issue when using standard attributes (on cache for example) because on new relic entity.type is a reserved attribute name and so it won’t work properly. cf Learn about New Relic entities Moreover entity.type is not consistent with our other graphql attributes (prefixed by graphql.). So we rename entity.type attribute to graphql.entity.type.

In order to make it work and that could also answer other use cases that would be great if we can alias the name of a standard attribute like this:

telemetry:
  instrumentation:
    spans:
      mode: spec_compliant # Docs state this significantly improves performance: https://www.apollographql.com/docs/router/configuration/telemetry/instrumentation/spans#spec_compliant
    instruments:
      cache: # Cache instruments configuration
        apollo.router.operations.entity.cache: # A counter which counts the number of cache hit and miss for subgraph requests
          attributes:
            graphql.entity.type:
              alias: entity_type # ENABLED and aliased to entity_type

Fixes #5930


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.

Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
@bnjjj bnjjj requested review from a team as code owners September 4, 2024 18:04

This comment has been minimized.

@router-perf
Copy link

router-perf bot commented Sep 4, 2024

CI performance tests

  • connectors-const - Connectors stress test that runs with a constant number of users
  • const - Basic stress test that runs with a constant number of users
  • demand-control-instrumented - A copy of the step test, but with demand control monitoring and metrics enabled
  • demand-control-uninstrumented - A copy of the step test, but with demand control monitoring enabled
  • enhanced-signature - Enhanced signature enabled
  • events - Stress test for events with a lot of users and deduplication ENABLED
  • 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_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_callback - Stress test for events with a lot of users and deduplication ENABLED in callback mode
  • events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
  • events_without_dedup_callback - Stress test for events with a lot of users and deduplication DISABLED using callback mode
  • extended-reference-mode - Extended reference mode enabled
  • large-request - Stress test with a 1 MB request payload
  • no-tracing - Basic stress test, no tracing
  • reload - Reload test over a long period of time at a constant rate of users
  • step-jemalloc-tuning - Clone of the basic stress test for jemalloc tuning
  • step-local-metrics - Field stats that are generated from the router rather than FTV1
  • step-with-prometheus - A copy of the step test with the Prometheus metrics exporter enabled
  • step - Basic stress test that steps up the number of users over time
  • xlarge-request - Stress test with 10 MB request payload
  • xxlarge-request - Stress test with 100 MB request payload

@bnjjj bnjjj requested review from garypen and BrynCooke September 5, 2024 12:22
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
BrynCooke
BrynCooke previously approved these changes Sep 5, 2024
@bnjjj bnjjj requested a review from a team as a code owner September 5, 2024 12:30
@bnjjj bnjjj requested a review from shorgi September 5, 2024 12:30
@BrynCooke BrynCooke dismissed their stale review September 5, 2024 12:30

Needs docs

@BrynCooke
Copy link
Contributor

We already have:

telemetry:
  instrumentation:
    instruments:
      graphql:
        foo:
          attributes:
            graphql.type.name: false
            graphql.operation.name: false
            graphql.field.name: false
            graphql.list.length: false
            graphql.field.type: false

Let's align on these names rather than adding alias support.

@bnjjj
Copy link
Contributor Author

bnjjj commented Sep 5, 2024

@BrynCooke Why not doing both ? I think we could still benefit from having aliases because sometimes some users would want to make a search over attributes or so and if they have a list of attributes and already use these attribute names somewhere else that could be an issue. So giving the ability to alias these standard attributes would still be valuable

@BrynCooke
Copy link
Contributor

Agree! Let's rename first and then we can take out the bit in the doc talking about new relic.

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
@bnjjj bnjjj requested a review from BrynCooke September 5, 2024 14:56
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
@bnjjj bnjjj requested a review from BrynCooke September 6, 2024 14:29
@bnjjj bnjjj enabled auto-merge (squash) September 6, 2024 14:35
@bnjjj bnjjj merged commit 5d11799 into dev Sep 6, 2024
14 checks passed
@bnjjj bnjjj deleted the bnjjj/fix_5930 branch September 6, 2024 15:25
glasser added a commit that referenced this pull request Sep 10, 2024
In #3829 we taught router to use the PQ list to prewarm the query
planner cache when reloading its schema.

In #5340 we gave it the experimental option to do the same thing at
startup.

Now we are allowing you to turn off the on-reload prewarm.

Because the PQ list does not have metadata to tell the Router which PQs
have been used recently, if you have a large PQ list then the on-reload
prewarm can slow down schema updates noticeably, and it may not provide
much value over prewarming based on the contents of the in-memory QP
cache itself.

We keep the same defaults, but let you turn off the on-reload prewarm
with:

```
persisted_queries:
  experimental_prewarm_query_plan_cache:
    on_reload: false
```

Previously, `persisted_queries.experimental_prewarm_query_plan_cache`
was a boolean; a migration moves this boolean to
`persisted_queries.experimental_prewarm_query_plan_cache.on_startup`.
(`on_startup` defaults to false and `on_reload` defaults to true.)

This migration uses a `type: change` action. No such actions existed in
the codebase and the implementation appeared to be buggy: there is no
top-level `==` operator (or top-level operators at all) in JSONPath.
This PR fixes the implementation of `type: change` to use the
`[?(@.x == y)]` filter syntax which does appear to work (as tested by
the migration tests for the new migration).

This also renames a migration file added in #5957 that used a
non-standard filename.
@abernix abernix mentioned this pull request Sep 24, 2024
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.

Add ability to alias the name of a standard attribute in custom telemetry
3 participants