jenkinsci / opentelemetry-plugin

Monitor and observe Jenkins with OpenTelemetry.
https://plugins.jenkins.io/opentelemetry/
Apache License 2.0
93 stars 47 forks source link

Unclear documentation for custom observability backend URLs #752

Open harveyrendell opened 7 months ago

harveyrendell commented 7 months ago

Describe your use-case which is not covered by existing documentation.

Hi there,

I am trying to configure a custom observability backend for New Relic using the following template https://one.newrelic.com/distributed-tracing?account=********&state=${traceId} as described in the url template example:

Trace visualization URL template
e.g. 'https://my-observability.example.com:5601/traces/\$\{traceId}'

However this causes pipelines to fail with the following errors:


groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:

GStringTemplateScript39.groovy: 2: unexpected char: '\' @ line 2, column 134.
   ****&state=\$\{traceid}

and after modifying it to remove the additional backslashes:

groovy.lang.MissingPropertyException: No such property: traceid for class: groovy.lang.Binding

Is traceId supposed to be set here? or is there some other prerequisite before I can configure a custom backend. These pipelines are using the multibranch pipeline type.

Thanks

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

https://github.com/jenkinsci/opentelemetry-plugin/blob/c03877572faca269d3691d1349976aebcf603ba9/src/main/resources/io/jenkins/plugins/opentelemetry/backend/CustomObservabilityBackend/config.jelly#L7

cyrille-leclerc commented 7 months ago

You are right that documentation is poor. We are incrementally improving. See

https://github.com/jenkinsci/opentelemetry-plugin/blob/0d8379807baf74026945863959e564a8ec443e18/src/main/java/io/jenkins/plugins/opentelemetry/backend/ObservabilityBackend.java#L173-L193

You should use traceId instead of traceid

cyrille-leclerc commented 7 months ago

There is a bug in the visualization, you should not use \ escape chars.

Please enter an url template like https://example.com/${traceId} and it will produce urls like https://example.com/4909241c7fe6438a95a25859375c2d07

cyrille-leclerc commented 7 months ago

See improvement:

DuMaM commented 6 months ago

Hi, I was fighting with NewRelic support for about a week. According to them, the value of state query is different from a trace ID. It's some random number connected with user session returned from NewRelic backend. Currently, there is no way to add tarceID URL which will redirect you to the Web UI page. You can only add URL to the dashboard to be visible for your users.

https://one.newrelic.com/distributed-tracing?account=********&state=${traceId}

btw. @cyrille-leclerc if you want you can put this into docs 😉