Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/int128/trace-workflows-action
Export a trace of GitHub Actions workflows to OpenTelemetry
https://github.com/int128/trace-workflows-action
github-actions observability opentelemetry
Last synced: 3 months ago
JSON representation
Export a trace of GitHub Actions workflows to OpenTelemetry
- Host: GitHub
- URL: https://github.com/int128/trace-workflows-action
- Owner: int128
- License: apache-2.0
- Created: 2024-09-12T04:01:12.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-27T19:48:02.000Z (4 months ago)
- Last Synced: 2024-09-28T14:22:04.173Z (4 months ago)
- Topics: github-actions, observability, opentelemetry
- Language: TypeScript
- Homepage:
- Size: 10.2 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trace-workflows-action [![ts](https://github.com/int128/trace-workflows-action/actions/workflows/ts.yaml/badge.svg)](https://github.com/int128/trace-workflows-action/actions/workflows/ts.yaml)
This is an action to export a trace of GitHub Actions workflows to OpenTelemetry.
## Example
Here is an example of trace exported to Datadog APM.
## Getting Started
This action needs to be run after all workflows are completed.
To run trace-workflows-action after [wait-for-workflows-action](https://github.com/int128/wait-for-workflows-action),
create the below workflows.```yaml
name: wait-for-workflowson:
pull_request:jobs:
wait-for-workflows:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: int128/wait-for-workflows-action@v1
``````yaml
name: trace-workflowson:
workflow_run:
types:
- completed
workflows:
- wait-for-workflowsjobs:
trace-workflows:
# Export a trace when all workflows are succeeded.
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: int128/trace-workflows-action@v0
with:
enable-otlp-exporter: true
env:
OTEL_EXPORTER_OTLP_ENDPOINT: http://opentelemetry-collector:4318
```## Specification
This action fetches the workflows run on the target commit.
See [the GraphQL query](src/queries/listChecks.ts) for details.### Trace attributes
This action exports the following attributes:
- Span name
- For an event, in the form of `owner/repo:event_name:ref`.
- For a workflow, the workflow name.
- For a job, the job name.
- Span status code
- If the workflow or job is failed, cancelled or timed out, ERROR.
- Otherwise, OK.
- `error.type`: The conclusion of workflow or job.
- `service.name`
- For an event, `github-actions-event`.
- For a workflow, `github-actions-workflow`.
- For a job, `github-actions-trace`.
- `service.version`: The target commit SHA.
- `host.name`: Determined from the GitHub URL, typically `github.com`.
- `deployment.environment.name`: The target branch name. If a pull request, `pr-` prefix and the number.
- `url.full`: GitHub URL to the workflow or job.
- `github.repository`: The repository name.
- `github.ref`: The target branch name.
- `github.sha`: The target commit SHA.
- `github.actor`: The actor who triggered the workflow.
- `github.event.name`: The event name.
- `github.workflow.name`: The workflow name.
- `github.job.name`: The job name.### Inputs
| Name | Default value | Description |
| ---------------------- | -------------- | -------------------------------- |
| `token` | `github.token` | GitHub token |
| `enable-otlp-exporter` | false | If true, export a trace via OTLP |### Environment variables
This action accepts the environment variables for the OTLP exporter.
See https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/ for details.### Outputs
None.