Open timja opened 5 months ago
cc @cyrille-leclerc / @kuisathaverat is this a sensible approach to make this work properly?
FYI we are simplifying the usage of OpenTelemetry in plugins improving the APIs of the Jenkins OpenTelemetry Plugin:
I would like to experiment this integration on a plugin to be sure we define the right APIs
cc @cyrille-leclerc / @kuisathaverat is this a sensible approach to make this work properly?
Please see my comment above, there may be a problem in the Jenkins OTel Plugin
FYI I have a change in progress in the Jenkins OTel Plugin to properly propagate the trace context to the Junit SQL Storage plugin. I the evolution of the Jenkisn OTel Plugin is successful, then this PR in the Junit SQL Storage Plugin will not be needed.
Here is an example that also includes the instrumentation of the JDBC datasource
This PR is no longer needed. The problem is now solved in the Jenkins OTel Plugin by:
On the latest version of the open telemetry plugin I can't seem to get the sql batch insert to show up at all not on master or this branch.
Are you running on the controller or a separate agent? Can you share more your configuration please?
Great ctch, I cleaned up my test environments and I still get the trace context propagation successful with the following:
junit-sql-storage:324.v90e2a_a_a_a_0dd7
opentelemetry:3.1320.v2eededb_d909e
@cyrille-leclerc how are you testing it? do you have a remote agent?
I just tried with this setup:
(Inbound agent secret will need replacing)
version: '3.1'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
jaeger:
image: jaegertracing/all-in-one:1.57
ports:
- "4317:4317"
- "16686:16686"
jenkins:
build:
context: .
ports:
- "8080:8080"
- "50000:50000"
- "5005:5005"
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4317
OTEL_SERVICE_NAME: jenkins
OTEL_METRICS_EXPORTER: none
OTEL_LOGS_EXPORTER: none
OTEL_JAVAAGENT_LOGGING: simple
JAVA_OPTS: "-Djenkins.install.runSetupWizard=false -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
jenkins-agent:
image: jenkins/inbound-agent
environment:
JENKINS_URL: http://jenkins:8080
JENKINS_SECRET: <replace-this>
JENKINS_AGENT_NAME: agent
JENKINS_AGENT_WORKDIR: /home/jenkins/agent
I was on the master branch of this repository and ran it with:
docker compose up -d --build
(note: I've made a couple of changes to the docker-compose files in the repo to test this fully)
and I don't get the sql trace:
(you can use the master docker-compose if you add these vars:)
+ environment:
+ # Since v0.105 the OTEL Collector components default hostname to 'localhost'.
+ # However, that does not work inside a Docker container, so we listen on all IPs.
+ # see https://github.com/jaegertracing/jaeger/issues/5737
+ COLLECTOR_OTLP_GRPC_HOST_PORT: 0.0.0.0:4317
+ COLLECTOR_OTLP_HTTP_HOST_PORT: 0.0.0.0:4318
Since it'll be fixed in the next version I wasn't going to bother checking it in for now although I lost some time trying to figure out what was happening
Sorry for the delay. Problem reproduced. We didn't think of plugins writing code that runs on the jenkins build agent and that would want to instrument this code. We have to look at this.
Please test the latest Jenkins OpenTelemetry Plugin with the configuration properties:
otel.instrumentation.jenkins.agent.enabled=true
otel.instrumentation.jenkins.remoting.enabled=true
Ignore the "INSERT my_shopping_cart.caseResults" and "PoolingDataSource.getConnection" that are an experiment of instrumenting the Jenkins Database Plugin, it's not released yet.
Requires https://github.com/jenkinsci/junit-plugin/pull/622
Amends https://github.com/jenkinsci/junit-sql-storage-plugin/pull/413 to set it up so spans have the correct parent so publishing the test results is tracked properly
Testing done
Freestyle:
Tested on a remote agent for Pipeline:
Submitter checklist