Nephrines opened a new issue, #9921:
URL: https://github.com/apache/apisix/issues/9921
### Description
Hello,
I'm encountering an issue when using the OpenTelemetry plugin with Apache
APISIX. I want to add some Nginx variables (such as `$request_time` and
`$upstream_response_time`) as additional attributes in my trace data.
Here is my configuration:
```json
{
"plugins": {
"opentelemetry": {
"sampler": {
"name": "always_on"
},
"additional_attributes": [
"upstream_response_time",
"request_time",
"host"
]
}
}
}
```
However, I get the following error when APISIX tries to process a request:
```
2023/07/27 20:31:33 [error] 50#50: *127339 lua entry thread aborted: runtime
error: ...deps/share/lua/5.1/opentelemetry/trace/exporter/otlp.lua:67: bad
argument #2 to 'encode' (string expected for field 'string_value', got number)
```
It seems that OpenTelemetry's OTLP exporter expects all attribute values to
be strings, but the values of Nginx variables like $request_time and
$upstream_response_time are not strings.
Is there a recommended way to convert these non-string values to strings
before adding them as additional attributes? Or could the OpenTelemetry plugin
be modified to automatically handle non-string attribute values?
Thank you for your help.
### Environment
- APISIX version (run `apisix version`): 2.15.0
- Operating system (run `uname -a`): Linux apisix-test-6cd7f9b885-cpq8b
5.15.0-60-generic
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`): nginx
version: openresty/1.21.4.1
- etcd version, if relevant (run `curl
http://127.0.0.1:9090/v1/server_info`): "etcd:3.5.4-debian-11-r14" image in k8s
- APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run `luarocks --version`): 3.8.0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]