Skip to content

Commit

Permalink
feat(opentelemetry): make endpoint field referenceable (#11220)
Browse files Browse the repository at this point in the history
* feat(opentelemetry): make endpoint field referenceable

* docs(changelog): add an entry to the changelog

(cherry picked from commit 3e52664)
  • Loading branch information
ms2008 authored and windmgc committed Jul 21, 2023
1 parent 9942c71 commit 8d59ac2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
The field `header_type`now accepts the `aws` value to handle this specific
propagation header.
[11075](https://github.com/Kong/kong/pull/11075)
- **Opentelemetry**: Support the `endpoint` parameter as referenceable.
[#11220](https://github.com/Kong/kong/pull/11220)
- **Ip-Restriction**: Add TCP support to the plugin.
Thanks [@scrudge](https://github.com/scrudge) for contributing this change.
[#10245](https://github.com/Kong/kong/pull/10245)
Expand Down
2 changes: 1 addition & 1 deletion kong/plugins/opentelemetry/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ return {
{ config = {
type = "record",
fields = {
{ endpoint = typedefs.url { required = true } }, -- OTLP/HTTP
{ endpoint = typedefs.url { required = true, referenceable = true } }, -- OTLP/HTTP
{ headers = { description = "The custom headers to be added in the HTTP request sent to the OTLP server. This setting is useful for adding the authentication headers (token) for the APM backend.", type = "map",
keys = typedefs.header_name,
values = {
Expand Down
3 changes: 3 additions & 0 deletions spec/03-plugins/37-opentelemetry/04-exporter_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ for _, strategy in helpers.each_strategy() do
describe("#referenceable fields", function ()
local mock
lazy_setup(function()
helpers.setenv("TEST_OTEL_ENDPOINT", "http://127.0.0.1:" .. HTTP_SERVER_PORT)
helpers.setenv("TEST_OTEL_ACCESS_KEY", "secret-1")
helpers.setenv("TEST_OTEL_ACCESS_SECRET", "secret-2")

Expand All @@ -476,6 +477,7 @@ for _, strategy in helpers.each_strategy() do
}, { "opentelemetry" }))

setup_instrumentations("all", {
endpoint = "{vault://env/test_otel_endpoint}",
headers = {
["X-Access-Key"] = "{vault://env/test_otel_access_key}",
["X-Access-Secret"] = "{vault://env/test_otel_access_secret}",
Expand All @@ -485,6 +487,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.unsetenv("TEST_OTEL_ENDPOINT")
helpers.unsetenv("TEST_OTEL_ACCESS_KEY")
helpers.unsetenv("TEST_OTEL_ACCESS_SECRET")
helpers.stop_kong()
Expand Down

0 comments on commit 8d59ac2

Please sign in to comment.