Skip to content

Add actions to add telemetry to GitHub pipelines#1011

Merged
Krusty93 merged 43 commits intomainfrom
CES-1118-tracciare-package-manager-su-app-insights-via-workflow
Feb 18, 2026
Merged

Add actions to add telemetry to GitHub pipelines#1011
Krusty93 merged 43 commits intomainfrom
CES-1118-tracciare-package-manager-su-app-insights-via-workflow

Conversation

@Krusty93
Copy link
Copy Markdown
Contributor

@Krusty93 Krusty93 commented Oct 21, 2025

Resolves CES-1118

This PR introduces a new telemetry stack for GitHub workflows composed of two actions:

  • setup-telemetry: initializes an OpenTelemetry session, creates a root span for the workflow run, flushes events in the post phase.
  • log-telemetry-event: appends structured NDJSON entries (custom events, exceptions, child span start/end markers) to a session file.

Key features:

  • Root workflow span (SpanKind.SERVER) with enrichment.
  • Child span support via start/end markers for hot path duration measurement.
  • Explicit exception logging.

New GitHub actions:

setup-telemetry

  • Creates OTEL resource
  • Reads environment variables:
    • PIPELINE_RESULT
    • NODE_PACKAGE_MANAGER
    • TERRAFORM_VERSION
    • CSP_LIST
  • Parses .otel-session/events.ndjson and:
    • Reconstructs child spans
    • Emits custom events
    • Emits exceptions

log-telemetry-event

Writes one NDJSON line per invocation.

Outcome
A root span containing one or more child elements including exceptions, custom events, dependencies and nested spans.
Each telemetry item contains attributes for cicd pipelines according to otel standard.

@Krusty93 Krusty93 requested a review from a team as a code owner October 21, 2025 10:04
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Oct 21, 2025

🦋 Changeset detected

Latest commit: b37ed6d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
log-telemetry-event Minor
setup-telemetry-action Minor
csp-login Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread .github/actions/node-setup/action.yaml Dismissed
Comment thread .github/actions/terraform-setup/action.yaml Dismissed
Comment thread .github/workflows/_tracking_application_insights.yaml Fixed
Comment thread .github/workflows/_tracking_application_insights.yaml Fixed
Comment thread .github/workflows/_tracking_application_insights.yaml Fixed
Comment thread .github/workflows/_tracking_application_insights.yaml Fixed
Comment thread .github/workflows/_tracking_application_insights.yaml Fixed
Comment thread .github/workflows/_tracking_application_insights.yaml Fixed
Comment thread .github/workflows/_tracking_application_insights.yaml Fixed
Comment thread actions/setup-telemetry/src/index.ts Fixed
Comment thread actions/setup-telemetry/package.json
Comment thread actions/setup-telemetry/src/index.ts Outdated
Comment thread actions/setup-telemetry/src/index.ts
Comment thread actions/setup-telemetry/src/post.ts Outdated
Comment thread actions/setup-telemetry/src/post.ts Outdated
Comment thread actions/setup-telemetry/src/post.ts Outdated
Comment thread actions/setup-telemetry/src/post.ts Outdated
@Krusty93 Krusty93 force-pushed the CES-1118-tracciare-package-manager-su-app-insights-via-workflow branch from 6d480b4 to adef77a Compare February 4, 2026 11:58
@pagopa pagopa deleted a comment from Copilot AI Feb 5, 2026
@pagopa pagopa deleted a comment from Copilot AI Feb 5, 2026
@Krusty93 Krusty93 force-pushed the CES-1118-tracciare-package-manager-su-app-insights-via-workflow branch 3 times, most recently from 27a090d to 7e974fa Compare February 5, 2026 09:15
@Krusty93 Krusty93 requested a review from Copilot February 5, 2026 09:15
@Krusty93 Krusty93 force-pushed the CES-1118-tracciare-package-manager-su-app-insights-via-workflow branch from 7e974fa to 75d649f Compare February 5, 2026 09:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 26 changed files in this pull request and generated 14 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread actions/setup-telemetry/src/post.ts Outdated
Comment thread actions/setup-telemetry/src/post.ts Outdated
Comment thread actions/setup-telemetry/src/index.ts Outdated
Comment thread actions/log-telemetry-event/README.md Outdated
Comment thread actions/setup-telemetry/src/post.ts Outdated
Comment thread actions/setup-telemetry/src/post.ts Outdated
Comment thread .github/workflows/_tracking_application_insights.yaml Outdated
Comment thread .github/workflows/_tracking_application_insights.yaml Outdated
Comment thread actions/setup-telemetry/src/post.ts Outdated
Comment thread actions/setup-telemetry/README.md Outdated
Comment thread actions/setup-telemetry/src/index.ts
Comment thread actions/setup-telemetry/src/index.ts Outdated
Comment thread actions/setup-telemetry/src/index.ts Outdated
Comment thread actions/setup-telemetry/src/post.ts
Comment thread actions/setup-telemetry/src/post.ts Outdated
Comment thread actions/setup-telemetry/src/post.ts Outdated
@kin0992
Copy link
Copy Markdown
Contributor

kin0992 commented Feb 5, 2026

I left a few minor comments and an issue that you should address first.
Anyway, it looks good after the recent changes! 👏

- Updated the setup-telemetry action to use async file operations with error handling.
- Introduced Zod validation for required environment variables in both setup and post-execution scripts.
- Refactored the telemetry line parsing logic to improve readability and maintainability.
- Created dedicated functions for processing event lines and span markers to streamline the telemetry data handling.
- Improved logging and error handling throughout the telemetry process.
- Ensured proper flushing of telemetry data before process exit.
Copy link
Copy Markdown
Contributor

@gunzip gunzip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, remember to switch to main references to CES-1118-tracciare-package-manager-su-app-insights-via-workflow before merging

@Krusty93 Krusty93 enabled auto-merge (squash) February 18, 2026 08:49
@Krusty93 Krusty93 disabled auto-merge February 18, 2026 08:49
@Krusty93 Krusty93 merged commit fd58eec into main Feb 18, 2026
6 checks passed
@Krusty93 Krusty93 deleted the CES-1118-tracciare-package-manager-su-app-insights-via-workflow branch February 18, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants