Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .github/workflows/tag-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,44 @@ jobs:
failure-description: "ERROR: Failed to publish OpenTelemetry Node.js Community Agent"
tag: ${{ needs.calculate.outputs.new_version }}

# ── 6. Trigger Odigos version update + Slack (runs only if publish succeeded; skipped when publish fails/skipped — no extra job if: needed)
# ── 6. Trigger consumer version updates (runs only if publish succeeded)
trigger-odigos-update:
needs: [calculate, publish]
runs-on: depot-ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Trigger agents version update in consumer repos
- name: Trigger agents version update in odigos
uses: odigos-io/ci-core/dispatch-agent-version-update@main
with:
instrumentation_agent: nodejs-community
version: ${{ needs.calculate.outputs.new_version }}
consumers: odigos

- name: Build ebpf-nodejs-instrumentation payload
id: payload-ebpf-nodejs
env:
AGENT_VERSION: ${{ needs.calculate.outputs.new_version }}
run: |
# Payload shape expected by ebpf-nodejs-instrumentation's
# update-nodejs-community-version repository_dispatch handler.
json="$(jq -nc --arg version "$AGENT_VERSION" \
'{nodejs_community_version: $version}')"
echo "json=$json" >> "$GITHUB_OUTPUT"

- name: Get sts token for ebpf-nodejs-instrumentation
id: sts-ebpf-nodejs
uses: odigos-io/ci-core/sts@main
with:
scope: odigos-io/ebpf-nodejs-instrumentation
identity: trigger-nodejs-community-version-updater
output-git-config: "false"

- name: Trigger update in ebpf-nodejs-instrumentation
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ steps.sts-ebpf-nodejs.outputs.GH_TOKEN }}
repository: odigos-io/ebpf-nodejs-instrumentation
event-type: update-nodejs-community-version
client-payload: ${{ steps.payload-ebpf-nodejs.outputs.json }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ COPY package.json yarn.lock .
RUN yarn install --frozen-lockfile
COPY . .
RUN echo "export const VERSION = \"$AGENT_VERSION\";" > ./src/version.ts
RUN echo "exports.VERSION = \"$AGENT_VERSION\";" > ./src/nodejs-community/version.js
RUN yarn compile

# this build step is only for the production node_modules.
Expand All @@ -23,4 +24,4 @@ COPY --from=nodejs-community-build /opentelemetry-node/package.json ./openteleme
COPY --from=nodejs-community-build /opentelemetry-node/LICENSE ./opentelemetry-node/LICENSE
COPY --from=nodejs-community-build /opentelemetry-node/build ./opentelemetry-node/build
COPY --from=nodejs-prod-modules /opentelemetry-node-prod/node_modules ./opentelemetry-node/node_modules
COPY --from=nodejs-community-build /opentelemetry-node/build/src/nodejs-community/autoinstrumentation.js ./nodejs-community/autoinstrumentation.js
COPY --from=nodejs-community-build /opentelemetry-node/src/nodejs-community/ ./nodejs-community/
8 changes: 4 additions & 4 deletions src/autoinstrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
AsyncLocalStorageContextManager,
} from "@opentelemetry/context-async-hooks";
import { context, propagation } from "@opentelemetry/api";
import { VERSION } from "./version";
import {
BatchSpanProcessor,
SpanProcessor,
Expand All @@ -51,6 +50,7 @@ export const createNativeCommunitySpanProcessor = (): SpanProcessor => {

export interface StartOpenTelemetryAgentOptions {
distroName: string;
distroVersion: string;
opampServerHost: string;
spanProcessorExporting: SpanProcessor;
additionalConfigs?: Record<string, InstrumentationLibraryConfigFunction>;
Expand All @@ -66,7 +66,7 @@ export interface StartOpenTelemetryAgentOptions {
// it allows the agent to provide its own span processor, depending on the
// agent implementation (for example - eBPF span processor for enterprise agent)
export const startOpenTelemetryAgent = (options: StartOpenTelemetryAgentOptions): InstrumentationLibrariesTracerProviderSetter | undefined => {
const { distroName, opampServerHost, spanProcessorExporting, additionalConfigs, configUpdateCallback, logger } = options;
const { distroName, distroVersion, opampServerHost, spanProcessorExporting, additionalConfigs, configUpdateCallback, logger } = options;

const otelDiag = createAndRegisterOtelDiag();

Expand All @@ -76,7 +76,7 @@ export const startOpenTelemetryAgent = (options: StartOpenTelemetryAgentOptions)

componentLogger.info("Starting Odigos OpenTelemetry auto-instrumentation agent", {
distroName,
distroVersion: VERSION,
distroVersion,
opampServerHost,
});

Expand All @@ -89,7 +89,7 @@ export const startOpenTelemetryAgent = (options: StartOpenTelemetryAgentOptions)

const staticResource = resourceFromAttributes({
[ATTR_TELEMETRY_DISTRO_NAME]: distroName,
[ATTR_TELEMETRY_DISTRO_VERSION]: VERSION,
[ATTR_TELEMETRY_DISTRO_VERSION]: distroVersion,
[ATTR_SERVICE_INSTANCE_ID]: serviceInstanceId,
[ATTR_TELEMETRY_SDK_LANGUAGE]: "nodejs",
});
Expand Down
2 changes: 2 additions & 0 deletions src/nodejs-community/autoinstrumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ try {
var createNativeCommunitySpanProcessor = opentelemetryNode.createNativeCommunitySpanProcessor;
var startOpenTelemetryAgent = opentelemetryNode.startOpenTelemetryAgent;
var createOdigosDiag = opentelemetryNode.createOdigosDiag;
var VERSION = require('./version').VERSION;
var logger = createOdigosDiag();
logger.info("Loading Odigos OpenTelemetry auto-instrumentation agent");

Expand All @@ -22,6 +23,7 @@ try {
var spanProcessor = createNativeCommunitySpanProcessor();
startOpenTelemetryAgent({
distroName: 'nodejs-community',
distroVersion: VERSION,
opampServerHost: opampServerHost,
spanProcessorExporting: spanProcessor,
logger: logger,
Expand Down
2 changes: 2 additions & 0 deletions src/nodejs-community/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// the content of the file is replaced with the real version in the DOCKERFILE
exports.VERSION = "development";
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

// the content of the file is replaced with the real version in the odiglet DOCKERFILE
// the content of the file is replaced with the real version in the DOCKERFILE
export const VERSION = "development";