opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

Testing Observability Pipeline

Open francisan opened this issue 1 year ago • 1 comments

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:

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]

francisan avatar Aug 27 '24 13:08 francisan

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?

francisan avatar Sep 04 '24 05:09 francisan

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. 👍

crobert-1 avatar Sep 06 '24 18:09 crobert-1

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

julianocosta89 avatar Sep 12 '24 13:09 julianocosta89