opentelemetry-collector
opentelemetry-collector copied to clipboard
Testing Observability Pipeline
Hi,
How I can test below pipeline using some sample payload. Want to test/ensure connector routes the request to corresponding pipeline based on the field 'name'.
receivers: webhookevent:
endpoint: 0.0.0.0:1111
path: /get/info
processors: transform/tr:
error_mode: ignore
log_statements:
- context: log
statements:
- set(body, ParseJSON(body)) where body != nil
- set(resource.attributes["name"], body["name"])
connectors: routing :
table:
- statement: route() where attributes["name"] == "abc"
pipelines:
- logs/abc
- statement: route() where attributes["name"] == "xyz"
pipelines:
- logs/xyz
exporters: logging:
- logs/xyz
loglevel: debug service: pipelines:
logs/receivers: receivers: [webhookevent] processors: [transform/tr] exporters: [routing,logging]
logs/abc: receivers: [routing] processors: [] exporters: [logging]
logs/xyz: receivers: [routing] processors: [] exporters: [logging]
Any thoughts on above issue?
Also, I am facing one issue in webhookevent receiver. If I put any new line in between Json, then rather than considering it as a single log statement, it will consider it as two different log statements.
For example,
If we use below Json, then it will consider it as a single log. We are good here. {"name" : "francis" ,"city" : "newyork"}
But if we use below Json, then it will consider it as 4 different logs. I think, ideally it should consider it as a single log statement.
{ "name": "francis", "city": "newyork" }
that is, { --->log1 "name": "francis", --->log2 "city": "newyork" --->log3 } --->log4
Why is it behaving in this way?
Hello @francisan, regarding generating data to test your configuration with, using telemetrygen is a good place to start.
Otherwise, if you need to test on very specific input data, you can save the log you want to test in a file and then use something like the file log receiver. 👍
I think we are good to close this one. @francisan opened this issue in the OTel demo as well: https://github.com/open-telemetry/opentelemetry-demo/issues/1712
And the discussion was moved to https://github.com/kubeshop/tracetest/issues/3997