Skip to content

Commit

Permalink
Add enabled field for telemetry exporters (#3952)
Browse files Browse the repository at this point in the history
Adds an enabled field to all the telemetry endpoint. 
We can now move away from use of Optional in the telemetry config structures.

Part of #3226

<!-- start metadata -->
---

**Checklist**

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

- [ ] Changes are compatible[^1]
- [ ] Documentation[^2] completed
- [ ] Performance impact assessed and acceptable
- Tests added and passing[^3]
    - [ ] Unit Tests
    - [ ] Integration Tests
    - [ ] Manual Tests

**Exceptions**

*Note any exceptions here*

**Notes**

[^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.

---------

Co-authored-by: bryn <[email protected]>
  • Loading branch information
BrynCooke and bryn authored Oct 3, 2023
1 parent 93cc98a commit ec6d2dd
Show file tree
Hide file tree
Showing 61 changed files with 276 additions and 138 deletions.
20 changes: 20 additions & 0 deletions .changesets/config_bryn_telemetry_enabled_field.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Add `enabled` field for telemetry exporters ([PR #3952](https://github.com/apollographql/router/pull/3952))

Telemetry configuration now supports `enabled` on all exporters. This allows exporters to be disabled without removing them from the configuration and in addition allows for a more streamlined default configuration.

```diff
telemetry:
tracing:
datadog:
+ enabled: true
jaeger:
+ enabled: true
otlp:
+ enabled: true
zipkin:
+ enabled: true
```

Existing configurations will be migrated to the new format automatically on startup. However, you should update your configuration to use the new format as soon as possible.

By [@BrynCooke](https://github.com/BrynCooke) in https://github.com/apollographql/router/pull/3952
8 changes: 4 additions & 4 deletions apollo-router/src/configuration/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,13 @@ impl Metrics {
opt.metrics.prometheus,
"$.metrics.prometheus[?(@.enabled==true)]",
opt.tracing.otlp,
"$.tracing.otlp[?(@.endpoint)]",
"$.tracing.otlp[?(@.enabled==true)]",
opt.tracing.datadog,
"$.tracing.datadog[?(@.endpoint)]",
"$.tracing.datadog[?(@.enabled==true)]",
opt.tracing.jaeger,
"$.tracing.jaeger[?(@..endpoint)]",
"$.tracing.jaeger[?(@.enabled==true)]",
opt.tracing.zipkin,
"$.tracing.zipkin[?(@.endpoint)]"
"$.tracing.zipkin[?(@.enabled==true)]"
);
log_usage_metrics!(
value.apollo.router.config.batching,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
description: Telemetry exporters now have an enabled field
actions:
- type: add
path: telemetry.tracing.jaeger
name: enabled
value: true
- type: add
path: telemetry.tracing.otlp
name: enabled
value: true
- type: add
path: telemetry.tracing.zipkin
name: enabled
value: true
- type: add
path: telemetry.tracing.datadog
name: enabled
value: true
- type: add
path: telemetry.metrics.otlp
name: enabled
value: true
Original file line number Diff line number Diff line change
Expand Up @@ -2073,19 +2073,6 @@ expression: "&schema"
"properties": {
"batch_processor": {
"description": "Configuration for batch processing.",
"default": {
"scheduled_delay": {
"secs": 5,
"nanos": 0
},
"max_queue_size": 2048,
"max_export_batch_size": 512,
"max_export_timeout": {
"secs": 30,
"nanos": 0
},
"max_concurrent_exports": 1
},
"type": "object",
"properties": {
"max_concurrent_exports": {
Expand Down Expand Up @@ -4501,24 +4488,11 @@ expression: "&schema"
"description": "Open Telemetry native exporter configuration",
"type": "object",
"required": [
"endpoint"
"enabled"
],
"properties": {
"batch_processor": {
"description": "Batch processor settings",
"default": {
"scheduled_delay": {
"secs": 5,
"nanos": 0
},
"max_queue_size": 2048,
"max_export_batch_size": 512,
"max_export_timeout": {
"secs": 30,
"nanos": 0
},
"max_concurrent_exports": 1
},
"type": "object",
"properties": {
"max_concurrent_exports": {
Expand Down Expand Up @@ -4560,6 +4534,10 @@ expression: "&schema"
}
}
},
"enabled": {
"description": "Enable otlp",
"type": "boolean"
},
"endpoint": {
"description": "The endpoint to send data to",
"type": "string"
Expand Down Expand Up @@ -4705,24 +4683,11 @@ expression: "&schema"
"description": "Datadog exporter configuration",
"type": "object",
"required": [
"endpoint"
"enabled"
],
"properties": {
"batch_processor": {
"description": "batch processor configuration",
"default": {
"scheduled_delay": {
"secs": 5,
"nanos": 0
},
"max_queue_size": 2048,
"max_export_batch_size": 512,
"max_export_timeout": {
"secs": 30,
"nanos": 0
},
"max_concurrent_exports": 1
},
"type": "object",
"properties": {
"max_concurrent_exports": {
Expand Down Expand Up @@ -4769,6 +4734,10 @@ expression: "&schema"
"default": false,
"type": "boolean"
},
"enabled": {
"description": "Enable datadog",
"type": "boolean"
},
"endpoint": {
"description": "The endpoint to send to",
"type": "string"
Expand Down Expand Up @@ -4800,15 +4769,12 @@ expression: "&schema"
{
"type": "object",
"required": [
"agent"
"enabled"
],
"properties": {
"agent": {
"description": "Agent configuration",
"type": "object",
"required": [
"endpoint"
],
"properties": {
"endpoint": {
"description": "The endpoint to send to",
Expand All @@ -4819,19 +4785,6 @@ expression: "&schema"
},
"batch_processor": {
"description": "Batch processor configuration",
"default": {
"scheduled_delay": {
"secs": 5,
"nanos": 0
},
"max_queue_size": 2048,
"max_export_batch_size": 512,
"max_export_timeout": {
"secs": 30,
"nanos": 0
},
"max_concurrent_exports": 1
},
"type": "object",
"properties": {
"max_concurrent_exports": {
Expand Down Expand Up @@ -4872,31 +4825,22 @@ expression: "&schema"
"type": "string"
}
}
},
"enabled": {
"description": "Enable Jaeger",
"type": "boolean"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"collector"
"enabled"
],
"properties": {
"batch_processor": {
"description": "Batch processor configuration",
"default": {
"scheduled_delay": {
"secs": 5,
"nanos": 0
},
"max_queue_size": 2048,
"max_export_batch_size": 512,
"max_export_timeout": {
"secs": 30,
"nanos": 0
},
"max_concurrent_exports": 1
},
"type": "object",
"properties": {
"max_concurrent_exports": {
Expand Down Expand Up @@ -4941,26 +4885,29 @@ expression: "&schema"
"collector": {
"description": "Collector configuration",
"type": "object",
"required": [
"endpoint"
],
"properties": {
"endpoint": {
"description": "The endpoint to send reports to",
"type": "string"
},
"password": {
"description": "The optional password",
"default": null,
"type": "string",
"nullable": true
},
"username": {
"description": "The optional username",
"default": null,
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"enabled": {
"description": "Enable Jaeger",
"type": "boolean"
}
},
"additionalProperties": false
Expand All @@ -4972,24 +4919,11 @@ expression: "&schema"
"description": "OpenTelemetry native exporter configuration",
"type": "object",
"required": [
"endpoint"
"enabled"
],
"properties": {
"batch_processor": {
"description": "Batch processor settings",
"default": {
"scheduled_delay": {
"secs": 5,
"nanos": 0
},
"max_queue_size": 2048,
"max_export_batch_size": 512,
"max_export_timeout": {
"secs": 30,
"nanos": 0
},
"max_concurrent_exports": 1
},
"type": "object",
"properties": {
"max_concurrent_exports": {
Expand Down Expand Up @@ -5031,6 +4965,10 @@ expression: "&schema"
}
}
},
"enabled": {
"description": "Enable otlp",
"type": "boolean"
},
"endpoint": {
"description": "The endpoint to send data to",
"type": "string"
Expand Down Expand Up @@ -5334,24 +5272,11 @@ expression: "&schema"
"description": "Zipkin exporter configuration",
"type": "object",
"required": [
"endpoint"
"enabled"
],
"properties": {
"batch_processor": {
"description": "Batch processor configuration",
"default": {
"scheduled_delay": {
"secs": 5,
"nanos": 0
},
"max_queue_size": 2048,
"max_export_batch_size": 512,
"max_export_timeout": {
"secs": 30,
"nanos": 0
},
"max_concurrent_exports": 1
},
"type": "object",
"properties": {
"max_concurrent_exports": {
Expand Down Expand Up @@ -5393,6 +5318,10 @@ expression: "&schema"
}
}
},
"enabled": {
"description": "Enable zipkin",
"type": "boolean"
},
"endpoint": {
"description": "The endpoint to send to",
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
source: apollo-router/src/configuration/tests.rs
expression: new_config
---
---
telemetry:
tracing:
datadog:
endpoint: default
enabled: true

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
source: apollo-router/src/configuration/tests.rs
expression: new_config
---
---
telemetry:
tracing:
jaeger:
agent:
endpoint: default
enabled: true

Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ telemetry:
endpoint: default
batch_processor:
scheduled_delay: 100ms
enabled: true

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
source: apollo-router/src/configuration/tests.rs
expression: new_config
---
---
telemetry:
tracing:
otlp:
endpoint: default
enabled: true
metrics:
otlp:
endpoint: default
enabled: true

Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ telemetry:
endpoint: default
batch_processor:
max_export_timeout: 5s
enabled: true

Loading

0 comments on commit ec6d2dd

Please sign in to comment.