-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenTelemetry instrumentation example #296
Conversation
otel/starter/main.go
Outdated
"go.temporal.io/sdk/client" | ||
"go.temporal.io/sdk/interceptor" | ||
|
||
otelworkflow "github.com/temporalio/samples-go/otel" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otelworkflow "github.com/temporalio/samples-go/otel" | |
"github.com/temporalio/samples-go/otel" |
No need for package alias and doesn't seem purely about workflows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will now clash with "go.temporal.io/sdk/contrib/opentelemetry"
otel/starter/main.go
Outdated
log.Fatalln("Unable to execute workflow", err) | ||
} | ||
|
||
log.Println("Started workflow", "WorkflowID", we.GetID(), "RunID", we.GetRunID()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The standard Go logger doesn't usually expect key-value pair type logs like structured logging does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is common to many other examples in the repo like: https://github.com/search?q=repo%3Atemporalio%2Fsamples-go+log.Println%28%22Started+workflow%22&type=code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 We get it wrong in those too, oh well. Can ignore.
Thanks! Looks great, just added some comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I think we can just drop the JSON and I'll merge. Thanks for the help here!
@emanuelef - I think you may need a |
When I do I get:
|
I think this is because you inadvertently updated API and server. Try to set |
If OpenTelemetry sample cannot be added without updating server, I am afraid this is going to have to wait on #264 to be solved. |
Is this something expected to be done soon ? |
I don't have a specific timeline, sorry |
Update Go SDK to v1.24.0
* created batch-sliding-window * renamed package * Added activities and workflows * Ported activities and workflows from Java * sliding window progress * simplistic test passes * Failure to drain reproduction * Added error handling to record_processor_workflow * added sort * Fixed batch partitions * Added description to README * Fixed nondeterminism errors
Add session failure sample
Update Go SDK to v1.25.0
@Quinn-With-Two-Ns can you have a look ? With the latest changes the tests (when running locally with make test) are passing. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good, we need to get CI working though
go.mod
Outdated
github.com/pborman/uuid v1.2.1 | ||
github.com/prometheus/client_golang v1.16.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrmm, wonder why this got removed. I think CI is failing here, may need a go mod tidy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is present as indirect: https://github.com/emanuelef/samples-go/blob/598b901b62e521741e3a78a27f071abcdc2188f9/go.mod#L52C1-L52C1
Tried to run go mod tidy
anyway and got:
go: github.com/temporalio/samples-go/codec-server/codec-server imports
go.temporal.io/server/common/config imports
go.temporal.io/server/common/telemetry imports
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc imports
go.opentelemetry.io/otel/exporters/otlp/internal: module go.opentelemetry.io/otel/exporters/otlp@latest found (v0.20.1), but does not contain package go.opentelemetry.io/otel/exporters/otlp/internal
go: github.com/temporalio/samples-go/codec-server/codec-server imports
go.temporal.io/server/common/config imports
go.temporal.io/server/common/telemetry imports
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc imports
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf imports
go.opentelemetry.io/otel/exporters/otlp/internal/envconfig: module go.opentelemetry.io/otel/exporters/otlp@latest found (v0.20.1), but does not contain package go.opentelemetry.io/otel/exporters/otlp/internal/envconfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go mod tidy
has to work on our samples. It appears that our server expects an older version of go.opentelemetry.io/otel
(https://github.com/temporalio/temporal/blob/v1.22.3/go.mod#L39). I think if you put to go.mod back as it was and just add that version of otel and then go mod tidy
it should figure it out. You may have to work with it. But you can't do a go get -u
or similar overall because it updated lots of unrelated dependencies here I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and now go mod tidy
doesn't complain, thanks.
Co-authored-by: Chad Retz <chad.retz@gmail.com>
Co-authored-by: Chad Retz <chad.retz@gmail.com>
Co-authored-by: Chad Retz <chad.retz@gmail.com>
@cretz ci-build is now passing |
What was changed
Added example to show how to instrument OpenTelemetry in the worker and client
Why?
Currently there is no sample to show how to instrument a Temporal worker and a client with OpenTelemetry.
This can save some time and clarifies what is the minimum needed to be able to export traces.
There's also an open issue:
#269
Checklist
Closes
How was this tested:
Run as most of the samples, no need to set OTLP endpoint and see the spans in the stdout.
Also tested with Honeycomb.io.
Updated README.md