Comments (6)
I'm wondering if we should introduce some Jenkins pipeline steps to expose io.opentelemetry.api.trace.Span#updateName(newName)
and io.opentelemetry.api.trace.Span#setAttribute(key, value)
.
@v1v would this solve your problem?
from opentelemetry-plugin.
The first improvement could be to use the label
attribute of the shell steps (sh
...) as span name: https://www.jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#sh-shell-script
from opentelemetry-plugin.
I'm wondering if we should introduce some Jenkins pipeline steps to expose io.opentelemetry.api.trace.Span#updateName(newName) and io.opentelemetry.api.trace.Span#setAttribute(key, value).
@v1v would this solve your problem?
Do you mean something like the below snippet?
pipeline {
...
...
spanService(name: 'my.docker.registry') {
sh 'docker login -u $user -p $pass $OTEL_STEP_SERVICE'
}
...
}
If so, will it be possible to populate the parent span attributes to the child sh
span?
from opentelemetry-plugin.
For this shell step, i was thinking of using the label
attribute of the sh
step (label: docker/login my.docker.registry
). The limit in my rationale is that I can just set the span name and not inject span attributes like jenkins.pipeline.step.type: docker/login
.
docker/login
and attributes net.peer.name: my.docker.registry
, rpc.service: docker
, rpc.method: login
, rpc.system: http
. Following the https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md) would require a wrapping step similar to what you suggested.
pipeline {
...
withCredentials([usernamePassword(
credentialsId: 'dockerCredentials',
usernameVariable: 'USERNAME',
passwordVariable: 'PASSWORD')]) {
sh (label: 'docker/login my.docker.registry', script: 'docker login -u $USERNAME -p $PASSWORD")
...
}
from opentelemetry-plugin.
I've been thinking about this particular feature and came up with the below idea.
People can opt-in if the step they call supports the apm
attributes, therefore we could allow people to use a new key in their call. This will only work for steps that don't have an argument validation.
Unfortunately, the step itself should provide the DataBoundSetter for the apm
argument:
pipeline {
...
...
theStep(..., apm: [ 'net.peer.name': 'my.docker.registry', 'rpc.service': 'docker', 'rpc.method': 'login', 'rpc.system': 'http']
...
}
If we like the above, we could even move forward and enhance the built-in steps to support the above, though we might need to raise a JEP to request such a functionality in the Jenkins Core and the Pipeline plugins, since there is a signature validation and unexisting parameters are not allowed (WorkflowScript: 8: Invalid parameter "apm", did you mean "label"?
)
To illustrate the above:
pipeline {
...
...
sh(label: 'docker login', script: 'docker login -u $user -p $pass $OTEL_STEP_SERVICE', apm: [ 'net.peer.name': 'my.docker.registry', 'rpc.service': 'docker', 'rpc.method': 'login', 'rpc.system': 'http'])
...
}
Why do I like this approach?
- Development experience, there will be always a new argument to leverage the existing attributes when using the plugin.
- Distributed traces to be a first citizen and supported by the Jenkins core (or workflows) by default.
In order to test the above I did raise the below changes:
- In the plugin itself -> #64
- In the durable task plugin -> v1v/workflow-durable-task-step-plugin@adc9afa or v1v/workflow-durable-task-step-plugin@2e8683f if it consumes the OtelStep class
Tests:
node() {
echo 'Hello World'
sh(script: 'echo hi', apm: [ 'net.peer.name': 'my.docker.registry', 'rpc.service': 'docker', 'rpc.method': 'login', 'rpc.system': 'http'])
}
Produced the below log traces
Apr 10, 2021 1:33:02 PM INFO io.jenkins.plugins.opentelemetry.job.CommonStepHandler createSpanBuilderFromApmDetails
Create apm {net.peer.name=my.docker.registry, rpc.service=docker, rpc.method=login, rpc.system=http}
And the span attributes are properly added:
What do you think?
from opentelemetry-plugin.
Close: we recommend to use the sh(label='xxx',...)
and the otel-cli
to add context
from opentelemetry-plugin.
Related Issues (20)
- [Regresion] testFreestyleJob_with_ant_plugin test is failling HOT 1
- Some logs lines have the display name (job #number) as pipeline_id and others the fullname
- Optionally include pipeline build span attributes in related step spans HOT 3
- I see a lot of GET calls which I want to mask for traces and just see BUILD HOT 1
- Using withSpanAttribute removes information about stages HOT 2
- MonitoringAction NOT found on run HOT 2
- Failed to parse URL
- Grafana visualization link does not work
- Add additional prometheus labels to metrics HOT 1
- Mirror logs into Elastic in an background like mode HOT 1
- Send Logs To Loki while Still Preserving Console Output HOT 5
- Allow to chose longer time range on grafana/tempo HOT 1
- When installing opentelemetry plugin in Cloudbees CI, traces are not getting generated. HOT 1
- Integrate Jenkins OpenTelemetry with Gradle OpenTelemetry HOT 4
- Generate AWS X-ray compatible trace IDs HOT 3
- We are not able to send Jenkins Logs on New Relic using this plugin on Jenkins server HOT 1
- Not getting all logs from build HOT 8
- Consume TRACEPARENT from upstream via environment variable while creating root span HOT 6
- No MonitoringAction found when Open the Console Output HOT 2
- Not getting queue metrics HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentelemetry-plugin.