Skip to content

Add otel#124

Closed
acouvreur wants to merge 2 commits into
cbrgm:mainfrom
acouvreur:add-otel
Closed

Add otel#124
acouvreur wants to merge 2 commits into
cbrgm:mainfrom
acouvreur:add-otel

Conversation

@acouvreur

Copy link
Copy Markdown
Contributor

Needs #122 for context propagation.

Few things that can be done in this PR or the next:

  • add documentation about setting up open telemtry
  • embed the library version so it can be set in the instrumentation scope version

Here's the output produced:

acouvreur has created respository %!d(string=acouvreurtesting/test){
	"Name": "handleRepositoryEventCreated",
	"SpanContext": {
		"TraceID": "4bb13a5aa15505b8eec1d737d2409bb6",
		"SpanID": "8ec590ae22f9e5ca",
		"TraceFlags": "01",
		"TraceState": "",
		"Remote": false
	},
	"Parent": {
		"TraceID": "4bb13a5aa15505b8eec1d737d2409bb6",
		"SpanID": "c1044a497dba633c",
		"TraceFlags": "01",
		"TraceState": "",
		"Remote": false
	},
	"SpanKind": 1,
	"StartTime": "2025-02-13T12:31:04.035946-05:00",
	"EndTime": "2025-02-13T12:31:04.036032639-05:00",
	"Attributes": [
		{
			"Key": "deliveryID",
			"Value": {
				"Type": "STRING",
				"Value": "c5103170-ea2f-11ef-9029-76e85b1fe031"
			}
		},
		{
			"Key": "event",
			"Value": {
				"Type": "STRING",
				"Value": "repository"
			}
		}
	],
	"Events": null,
	"Links": null,
	"Status": {
		"Code": "Unset",
		"Description": ""
	},
	"DroppedAttributes": 0,
	"DroppedEvents": 0,
	"DroppedLinks": 0,
	"ChildSpanCount": 0,
	"Resource": [
		{
			"Key": "service.name",
			"Value": {
				"Type": "STRING",
				"Value": "unknown_service:main"
			}
		},
		{
			"Key": "telemetry.sdk.language",
			"Value": {
				"Type": "STRING",
				"Value": "go"
			}
		},
		{
			"Key": "telemetry.sdk.name",
			"Value": {
				"Type": "STRING",
				"Value": "opentelemetry"
			}
		},
		{
			"Key": "telemetry.sdk.version",
			"Value": {
				"Type": "STRING",
				"Value": "1.34.0"
			}
		}
	],
	"InstrumentationScope": {
		"Name": "github.com/cbrgm/githubevents",
		"Version": "",
		"SchemaURL": "",
		"Attributes": null
	},
	"InstrumentationLibrary": {
		"Name": "github.com/cbrgm/githubevents",
		"Version": "",
		"SchemaURL": "",
		"Attributes": null
	}
}
{
	"Name": "RepositoryEvent",
	"SpanContext": {
		"TraceID": "4bb13a5aa15505b8eec1d737d2409bb6",
		"SpanID": "c1044a497dba633c",
		"TraceFlags": "01",
		"TraceState": "",
		"Remote": false
	},
	"Parent": {
		"TraceID": "4bb13a5aa15505b8eec1d737d2409bb6",
		"SpanID": "3114c69a3a81e57c",
		"TraceFlags": "01",
		"TraceState": "",
		"Remote": false
	},
	"SpanKind": 1,
	"StartTime": "2025-02-13T12:31:04.035938-05:00",
	"EndTime": "2025-02-13T12:31:04.036042429-05:00",
	"Attributes": [
		{
			"Key": "deliveryID",
			"Value": {
				"Type": "STRING",
				"Value": "c5103170-ea2f-11ef-9029-76e85b1fe031"
			}
		},
		{
			"Key": "event",
			"Value": {
				"Type": "STRING",
				"Value": "repository"
			}
		}
	],
	"Events": null,
	"Links": null,
	"Status": {
		"Code": "Unset",
		"Description": ""
	},
	"DroppedAttributes": 0,
	"DroppedEvents": 0,
	"DroppedLinks": 0,
	"ChildSpanCount": 1,
	"Resource": [
		{
			"Key": "service.name",
			"Value": {
				"Type": "STRING",
				"Value": "unknown_service:main"
			}
		},
		{
			"Key": "telemetry.sdk.language",
			"Value": {
				"Type": "STRING",
				"Value": "go"
			}
		},
		{
			"Key": "telemetry.sdk.name",
			"Value": {
				"Type": "STRING",
				"Value": "opentelemetry"
			}
		},
		{
			"Key": "telemetry.sdk.version",
			"Value": {
				"Type": "STRING",
				"Value": "1.34.0"
			}
		}
	],
	"InstrumentationScope": {
		"Name": "github.com/cbrgm/githubevents",
		"Version": "",
		"SchemaURL": "",
		"Attributes": null
	},
	"InstrumentationLibrary": {
		"Name": "github.com/cbrgm/githubevents",
		"Version": "",
		"SchemaURL": "",
		"Attributes": null
	}
}
{
	"Name": "HandleEvent",
	"SpanContext": {
		"TraceID": "4bb13a5aa15505b8eec1d737d2409bb6",
		"SpanID": "3114c69a3a81e57c",
		"TraceFlags": "01",
		"TraceState": "",
		"Remote": false
	},
	"Parent": {
		"TraceID": "4bb13a5aa15505b8eec1d737d2409bb6",
		"SpanID": "b3a1f519e440b9da",
		"TraceFlags": "01",
		"TraceState": "",
		"Remote": false
	},
	"SpanKind": 1,
	"StartTime": "2025-02-13T12:31:04.03593-05:00",
	"EndTime": "2025-02-13T12:31:04.036050977-05:00",
	"Attributes": null,
	"Events": null,
	"Links": null,
	"Status": {
		"Code": "Unset",
		"Description": ""
	},
	"DroppedAttributes": 0,
	"DroppedEvents": 0,
	"DroppedLinks": 0,
	"ChildSpanCount": 1,
	"Resource": [
		{
			"Key": "service.name",
			"Value": {
				"Type": "STRING",
				"Value": "unknown_service:main"
			}
		},
		{
			"Key": "telemetry.sdk.language",
			"Value": {
				"Type": "STRING",
				"Value": "go"
			}
		},
		{
			"Key": "telemetry.sdk.name",
			"Value": {
				"Type": "STRING",
				"Value": "opentelemetry"
			}
		},
		{
			"Key": "telemetry.sdk.version",
			"Value": {
				"Type": "STRING",
				"Value": "1.34.0"
			}
		}
	],
	"InstrumentationScope": {
		"Name": "github.com/cbrgm/githubevents",
		"Version": "",
		"SchemaURL": "",
		"Attributes": null
	},
	"InstrumentationLibrary": {
		"Name": "github.com/cbrgm/githubevents",
		"Version": "",
		"SchemaURL": "",
		"Attributes": null
	}
}
{
	"Name": "HandleEventRequest",
	"SpanContext": {
		"TraceID": "4bb13a5aa15505b8eec1d737d2409bb6",
		"SpanID": "b3a1f519e440b9da",
		"TraceFlags": "01",
		"TraceState": "",
		"Remote": false
	},
	"Parent": {
		"TraceID": "00000000000000000000000000000000",
		"SpanID": "0000000000000000",
		"TraceFlags": "00",
		"TraceState": "",
		"Remote": false
	},
	"SpanKind": 1,
	"StartTime": "2025-02-13T12:31:04.028642-05:00",
	"EndTime": "2025-02-13T12:31:04.03605199-05:00",
	"Attributes": null,
	"Events": null,
	"Links": null,
	"Status": {
		"Code": "Unset",
		"Description": ""
	},
	"DroppedAttributes": 0,
	"DroppedEvents": 0,
	"DroppedLinks": 0,
	"ChildSpanCount": 1,
	"Resource": [
		{
			"Key": "service.name",
			"Value": {
				"Type": "STRING",
				"Value": "unknown_service:main"
			}
		},
		{
			"Key": "telemetry.sdk.language",
			"Value": {
				"Type": "STRING",
				"Value": "go"
			}
		},
		{
			"Key": "telemetry.sdk.name",
			"Value": {
				"Type": "STRING",
				"Value": "opentelemetry"
			}
		},
		{
			"Key": "telemetry.sdk.version",
			"Value": {
				"Type": "STRING",
				"Value": "1.34.0"
			}
		}
	],
	"InstrumentationScope": {
		"Name": "github.com/cbrgm/githubevents",
		"Version": "",
		"SchemaURL": "",
		"Attributes": null
	},
	"InstrumentationLibrary": {
		"Name": "github.com/cbrgm/githubevents",
		"Version": "",
		"SchemaURL": "",
		"Attributes": null
	}
}

@acouvreur
acouvreur requested a review from cbrgm as a code owner February 13, 2025 17:41
@cbrgm

cbrgm commented Feb 17, 2025

Copy link
Copy Markdown
Owner

See my comment #122 (comment)

@cbrgm

cbrgm commented Mar 4, 2025

Copy link
Copy Markdown
Owner

Hiho, can you rebase this PR with the latest changes from main? Every example now is its own Go project with an individual go.modfile. Can you add one for this example as well? 😄 Looking forward to get this merged! Thanks a lot!

@acouvreur

Copy link
Copy Markdown
Contributor Author

Hiho, can you rebase this PR with the latest changes from main? Every example now is its own Go project with an individual go.modfile. Can you add one for this example as well? 😄 Looking forward to get this merged! Thanks a lot!

Sure will do, however, I'm not sure if I should create a new trace everytime. I don't know what the otel implementation should be for each handler.

Do you have a suggestion ?

@github-actions github-actions Bot added the Stale label May 6, 2025
@github-actions github-actions Bot closed this May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants