feat(dcgw): Add OTEL_RESOURCE_ATTRIBUTES as supported#5480
Open
cloudjumpercat wants to merge 2 commits into
Open
feat(dcgw): Add OTEL_RESOURCE_ATTRIBUTES as supported#5480cloudjumpercat wants to merge 2 commits into
cloudjumpercat wants to merge 2 commits into
Conversation
Signed-off-by: Diana <75819066+cloudjumpercat@users.noreply.github.com>
✅ Deploy Preview for kongdeveloper ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Dedicated Cloud Gateways reference documentation to include OpenTelemetry resource attributes as a supported configuration option for data plane nodes.
Changes:
- Adds
otel_resource_attributesto thekong_config_table envlist in the DCGW reference configuration section.
Comment on lines
430
to
433
| - name: trusted_ips | ||
| - name: otel_resource_attributes | ||
| {% endkong_config_table %} | ||
| <!--vale on --> |
Signed-off-by: Diana <75819066+cloudjumpercat@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #5256
Preview Links
https://deploy-preview-5480--kongdeveloper.netlify.app/dedicated-cloud-gateways/reference/#kong-gateway-configuration
Question for reviewers: In 3.15, we're supporting OTEL_RESOURCE_ATTRIBUTES as an env var. This one WON'T have a KONG prefix. DCGW is supporting it, but when I add it to the {% kong_config_table env %} table, it automatically prefixes it with KONG_. I've attempted to update the table with Claude's fix (detailed below). It also seems like the env var isn't in the kong.conf JSON that was just generated a few days ago despite the Jira ticket saying it was completed.
Claude's fix for the table
This is the summary of what Claude says it's fixing:
Context
In Gateway 3.15, Dedicated Cloud Gateways support OTEL_RESOURCE_ATTRIBUTES as an environment variable. Unlike every other DCGW env var, this one is a standard OpenTelemetry variable and does not carry the KONG_ prefix.
The {% kong_config_table env %} block in app/dedicated-cloud-gateways/reference.md:401-433 automatically renders each field name as KONG_ in env mode. The prefixing happens in format_name at app/_plugins/drops/kong_config_table.rb:35-40:
def format_name(name, mode)
return name if mode == 'conf'
return "KONG_#{name.upcase}" if mode == 'env'
raise "Unknown kong_config_table mode: #{mode}"
end
There is currently no way to render an un-prefixed env var, so otel_resource_attributes renders incorrectly as KONG_OTEL_RESOURCE_ATTRIBUTES.
Approach
Add an opt-out flag, prefix: false, that can be set on an individual config entry. When set, env mode renders the upcased name without the KONG_ prefix.
KongConfigField already holds the per-field config hash in @config, so no signature changes are needed. Update format_name to honor the flag:
def format_name(name, mode)
return name if mode == 'conf'
if mode == 'env'
return name.upcase if @config['prefix'] == false
end
raise "Unknown kong_config_table mode: #{mode}"
end
Default behavior is unchanged (flag absent or true keeps the KONG_ prefix), so the other 17 files using the block are unaffected.
Checklist
descriptionentry in frontmatter.