jenkinsci / opentelemetry-plugin

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

Trace Context not propagated in the plugin code that executes Jenkins agents #904

Closed cyrille-leclerc closed 2 months ago

cyrille-leclerc commented 4 months ago

What feature do you want to see added?

Propage trace context in the calls sent in the Grafana Agent

Upstream changes

No response

Are you interested in contributing this feature?

No response

Notes

https://github.com/jenkinsci/junit-plugin/blob/85201a38881e5811c8632b610d8d655f161db103/src/main/java/hudson/tasks/junit/JUnitParser.java#L122-L134

https://github.com/jenkinsci/jenkins/blob/0d5232fca40a12b2d14f7ded577a90f0cb3c6f06/core/src/main/java/hudson/FilePath.java

    /**
     * Executes some program on the machine that this {@link FilePath} exists,
     * so that one can perform local file operations.
     */
    public <T> T act(final FileCallable<T> callable) throws IOException, InterruptedException {
        return act(callable, callable.getClass().getClassLoader());
    }

    private <T> T act(final FileCallable<T> callable, ClassLoader cl) throws IOException, InterruptedException {
        if (channel != null) {
            // run this on a remote system
            try {
                DelegatingCallable<T, IOException> wrapper = new FileCallableWrapper<>(callable, cl, this);
                for (FileCallableWrapperFactory factory : ExtensionList.lookup(FileCallableWrapperFactory.class)) {
                    wrapper = factory.wrap(wrapper);
                }
                return channel.call(wrapper);
            } catch (TunneledInterruptedException e) {
                throw (InterruptedException) new InterruptedException(e.getMessage()).initCause(e);
            }
        } else {
            // the file is on the local machine.
            return callable.invoke(new File(remote), localChannel);
        }
    }
cyrille-leclerc commented 2 months ago

Fixed in