Skip to content

Commit

Permalink
chore(ci): update send annotation workflow (#1067)
Browse files Browse the repository at this point in the history
* change permissions

* remove azuere login

* re enable permission

* remove write permission

* update action

* fix tracer action :D
  • Loading branch information
sduranc authored Oct 31, 2024
1 parent 6b379c0 commit a0fa85c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/grafana-annotation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:

permissions:
id-token: write
contents: write
contents: read

jobs:
deploy-annotation:
Expand All @@ -32,13 +32,6 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: 'Azure login'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Create Grafana Annotation
run: |
timestamp=$(date +%s%3N) # Use millisecond resolution, as requested by the annotations api
Expand All @@ -57,7 +50,7 @@ jobs:
}"
- name: Send Trace to Azure Monitor
uses: altinn/altinn-platform/actions/[email protected].0
uses: altinn/altinn-platform/actions/[email protected].1
with:
connection_string: ${{ secrets.APP_INSIGHTS_CONNECTION_STRING }}
app: "${{ github.event.inputs.app }}"
Expand Down
16 changes: 2 additions & 14 deletions actions/send-ci-cd-trace/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
} from "@opentelemetry/api";
import { useAzureMonitor, AzureMonitorOpenTelemetryOptions, shutdownAzureMonitor } from "@azure/monitor-opentelemetry";
import { AzureMonitorTraceExporter } from "@azure/monitor-opentelemetry-exporter";
import { ReadableSpan, BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
import { ExportResult, ExportResultCode } from "@opentelemetry/core";
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";


async function run() {
try {
Expand Down Expand Up @@ -54,18 +54,6 @@ async function run() {
maxQueueSize: 500,
});

// Wrap the export function to log export results
const originalExport = azureExporter.export.bind(azureExporter);
azureExporter.export = async (spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): Promise<void> => {
originalExport(spans, (result) => {
if (result.code === ExportResultCode.SUCCESS) {
console.log(`Successfully exported ${spans.length} span(s).`);
} else {
console.error(`Failed to export spans. Code: ${result.code}`);
}
resultCallback(result);
});
};
const options: AzureMonitorOpenTelemetryOptions = {
azureMonitorExporterOptions: {
connectionString: connectionString,
Expand Down

0 comments on commit a0fa85c

Please sign in to comment.