Skip to content

Commit

Permalink
Cleanup (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
corentinmusard committed May 1, 2024
1 parent 836ad67 commit 2c39da7
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 211 deletions.
12 changes: 0 additions & 12 deletions .github/dependabot.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/build-main.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
name: "code quality PR check"
name: "Build"

on:
pull_request:
paths:
- "src/**"
- "package-lock.json"
- "tests/**"
- "dist/**"
- "tsconfig.json"
- .github/workflows/code-quality-pr-check.yml
push:
branches: [main]
pull_request:
merge_group:
branches: ["**"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "16"
cache: "npm"
Expand All @@ -38,8 +34,8 @@ jobs:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "16"
cache: "npm"
Expand All @@ -58,15 +54,13 @@ jobs:
otel-export-trace:
needs: [tests, build]
if: always()
name: OpenTelemetry Export Trace
name: OpenTelemetry Export Traces
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: export trace
- uses: actions/checkout@v4
- name: Export traces
uses: ./
with:
otlpEndpoint: "TEST"
otlpHeaders: "TEST"
otlpEndpoint: ${{ secrets.OTLP_ENDPOINT }}
otlpHeaders: ${{ secrets.OTLP_HEADERS }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
env:
OTEL_CONSOLE_ONLY: "true"
26 changes: 0 additions & 26 deletions .github/workflows/dependabot-update-dist.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/merge-gatekeeper.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/otel-cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: OpenTelemetry Export Traces

on:
workflow_run:
workflows:
- "Build"
types: [completed]

jobs:
otel-export-traces:
name: OpenTelemetry Export Traces
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Export traces
uses: ./
with:
otlpEndpoint: ${{ secrets.OTLP_ENDPOINT }}
otlpHeaders: ${{ secrets.OTLP_HEADERS }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
runId: ${{ github.event.workflow_run.id }}
21 changes: 0 additions & 21 deletions .github/workflows/otel-export-trace.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/version-update.yml

This file was deleted.

27 changes: 0 additions & 27 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,28 +1 @@
# Changelog

## [1.8.0](https://www.github.com/inception-health/otel-export-trace-action/compare/v1.7.0...v1.8.0) (2023-03-07)


### Features

* add pull_requests attributes ([#30](https://www.github.com/inception-health/otel-export-trace-action/issues/30)) ([083bce1](https://www.github.com/inception-health/otel-export-trace-action/commit/083bce13bd12677eb6914a59271b253ec1eac35e))

## [1.7.0](https://www.github.com/inception-health/otel-export-trace-action/compare/v1.6.0...v1.7.0) (2023-01-25)


### Features

* **#31:** Omit spans for skipped and canceled jobs ([#33](https://www.github.com/inception-health/otel-export-trace-action/issues/33)) ([8ef4ea0](https://www.github.com/inception-health/otel-export-trace-action/commit/8ef4ea0ab7a65ffa2ddfcb8ef9f39b3417b57f15))


### Bug Fixes

* build ([#35](https://www.github.com/inception-health/otel-export-trace-action/issues/35)) ([4ea5bca](https://www.github.com/inception-health/otel-export-trace-action/commit/4ea5bca9c404a0e219662adf190585af9dc23566))

## [1.6.0](https://www.github.com/inception-health/otel-export-trace-action/compare/v1.5.8...v1.6.0) (2022-07-26)


### Features

* **#12:** add otel service name as an input or env var ([3ed67f9](https://www.github.com/inception-health/otel-export-trace-action/commit/3ed67f9c65770a55a98fa24fe0e9e110328690eb))
* **#12:** add otel service name as an input or env var ([#13](https://www.github.com/inception-health/otel-export-trace-action/issues/13)) ([3ed67f9](https://www.github.com/inception-health/otel-export-trace-action/commit/3ed67f9c65770a55a98fa24fe0e9e110328690eb)), closes [#12](https://www.github.com/inception-health/otel-export-trace-action/issues/12)
67 changes: 41 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Open Telemetry Trace Exporter Action
# Open Telemetry CI/CD Action

This action will export GitHub Workflow telemetry data using OTLP to a configurable endpoint.
This action export GitHub Workflow telemetry data using OTLP to a configurable endpoint.

This is a fork of [inception-health/otel-export-trace-action](https://github.com/inception-health/otel-export-trace-action) with the goal of maintaining the action and adding more features.

## Usage

### On workflow_run Event
### On workflow_run event (recommended)

`my-workflow` should be the name of the workflow you want to export.

```yaml
name: OpenTelemetry Export Trace
Expand All @@ -28,7 +32,7 @@ jobs:
runId: ${{ github.event.workflow_run.id }}
```
### On Current Workflow
### Inside an existing workflow
```yaml
name: OpenTelemetry Export Trace
Expand All @@ -54,7 +58,30 @@ jobs:
githubToken: ${{ secrets.GITHUB_TOKEN }}
```
### With Junit Tracing
### Action Inputs
| name | description | required | default |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------- |
| otlpEndpoint | The destination endpoint to export OpenTelemetry traces to. It supports `https://` and `grpc:https://` endpoints. | true | |
| otlpHeaders | Network Headers for the destination endpoint to export OpenTelemetry traces to. Ex. `x-honeycomb-team=YOUR_API_KEY,x-honeycomb-dataset=YOUR_DATASET`. | true | |
| otelServiceName | OpenTelemetry service name | false | `<The name of the exported workflow>` |
| githubToken | The repository token with Workflow permissions. Not required for public repos | false | |
| runId | Workflow Run ID to Export | false | env.GITHUB_RUN_ID |

### Action Outputs

| name | description |
| ------- | ----------------------------------------- |
| traceId | The OpenTelemetry Trace ID for this Trace |

## Honeycomb Example Trace

![HoneyComb Example](./docs/honeycomb-example.png)

_with JUnit traces_
![HoneyComb Junit Example](./docs/honeycomb-junit-example.png)

## With Junit Tracing

Combined with [OpenTelemetry Upload Trace Artifact](https://github.com/marketplace/actions/opentelemetry-upload-trace-artifact) this action will Download the OTLP Trace Log Artifact uploaded from the Workflow Run and export it.

Expand Down Expand Up @@ -111,22 +138,6 @@ jobs:
runId: ${{ github.event.workflow_run.id }}
```

### Action Inputs
| name | description | required | default |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------- |
| otlpEndpoint | The destination endpoint to export OpenTelemetry traces to | true | |
| otlpHeaders | Network Headers for the destination endpoint to export OpenTelemetry traces to. Ex. `x-honeycomb-team=YOUR_API_KEY,x-honeycomb-dataset=YOUR_DATASET` | true | |
| otelServiceName | OpenTelemetry service name | false | |
| githubToken | The repository token with Workflow permissions. Not required for public repos | false | |
| runId | Workflow Run ID to Export | false | env.GITHUB_RUN_ID |

### Action Outputs

| name | description |
| ------- | ----------------------------------------- |
| traceId | The OpenTelemetry Trace ID for this Trace |

## Trace Unique Fields

| name | type | description |
Expand Down Expand Up @@ -194,9 +205,13 @@ jobs:
| github.job.step.started_at | string | Github Step Run started_at |
| github.job.step.completed_at | string | Github Step Run completed_at |

## Honeycomb Example Trace

![HoneyComb Example](./docs/honeycomb-example.png)
## Development setup

_with JUnit traces_
![HoneyComb Junit Example](./docs/honeycomb-junit-example.png)
```sh
# temporary fix
export NODE_OPTIONS=--openssl-legacy-provider
npm run prepare
npm i
npm run dev
npm run test
```
10 changes: 10 additions & 0 deletions src/tracing/trace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,14 @@ describe("createTracerProvider", () => {
const spanProcessor = subject.getActiveSpanProcessor();
expect(spanProcessor).toBeDefined();
});

it("supports https", () => {
subject = createTracerProvider(
"https://localhost",
"test=foo",
mockWorkflowRunJobs
);
const spanProcessor = subject.getActiveSpanProcessor();
expect(spanProcessor).toBeDefined();
});
});

0 comments on commit 2c39da7

Please sign in to comment.