Skip to content
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

OtelFiber: Use tracetest #657

Merged
merged 21 commits into from
Jul 31, 2023
Merged

Conversation

emanuelef
Copy link
Contributor

SA1019: "go.opentelemetry.io/otel/oteltest" is deprecated: This package contains an alternate implementation of the OpenTelemetry SDK. This means it will diverge from the one commonly used in real world operations and therefore will not provide adequate testing guarantees for users. Because of this, this package should not be used to test performance or behavior of code running OpenTelemetry. Instead, the SpanRecorder from the go.opentelemetry.io/otel/sdk/trace/tracetest package can be registered with the default SDK (go.opentelemetry.io/otel/sdk/trace) as a SpanProcessor and used to test. This will ensure code will work with the default SDK. If users do not want to include a dependency on the default SDK it is recommended to run integration tests in their own module to isolate the dependency (see go.opentelemetry.io/otel/bridge/opencensus/test as an example).

https://pkg.go.dev/go.opentelemetry.io/otel/oteltest

This is the approach to use if moving to go.opentelemetry.io/otel/sdk/trace/tracetest
https://github.com/open-telemetry/opentelemetry-go/tree/main/bridge/opencensus/test

@emanuelef emanuelef marked this pull request as draft June 20, 2023 06:22
@emanuelef emanuelef changed the title Use tracetest OtelFiber: Use tracetest Jun 20, 2023
@ReneWerner87 ReneWerner87 linked an issue Jun 20, 2023 that may be closed by this pull request
3 tasks
@gaby
Copy link
Member

gaby commented Jun 22, 2023

@emanuelef Can you rebase, and remove 1.18.x from the otelfiber test suite

@emanuelef
Copy link
Contributor Author

@emanuelef Can you rebase, and remove 1.18.x from the otelfiber test suite

Sure, but will that mean 1.18 is no longer supported in all the tests ?

@gaby
Copy link
Member

gaby commented Jun 22, 2023

@emanuelef Can you rebase, and remove 1.18.x from the otelfiber test suite

Sure, but will that mean 1.18 is no longer supported in all the tests ?

Only remove it for otelfiber. :-) But yes, it means we will have to release a major release for this middleware to drop support for go 1.18.x

@gaby
Copy link
Member

gaby commented Jun 22, 2023

@emanuelef Can you rebase, and remove 1.18.x from the otelfiber test suite

Sure, but will that mean 1.18 is no longer supported in all the tests ?

Only remove it for otelfiber. :-) But yes, it means we will have to release a major release for this middleware to drop support for go 1.18.x

Oh, I see what you mean... The tests CI is running all the middleware's in one place.

@ReneWerner87
Copy link
Member

pls increate the major number in the go.mod version

https://github.com/gofiber/contrib/blob/main/otelfiber/go.mod#L1
to

module github.com/gofiber/contrib/otelfiber/v2
and the readme instructions

@emanuelef
Copy link
Contributor Author

@emanuelef Can you rebase, and remove 1.18.x from the otelfiber test suite

Sure, but will that mean 1.18 is no longer supported in all the tests ?

Only remove it for otelfiber. :-) But yes, it means we will have to release a major release for this middleware to drop support for go 1.18.x

Oh, I see what you mean... The tests CI is running all the middleware's in one place.

Indeed, changing that will drop 1.18 testing for all the others. Should we split the test action ? But I guess in case that would be another PR.

@gaby
Copy link
Member

gaby commented Jun 24, 2023

@emanuelef Can you rebase, and remove 1.18.x from the otelfiber test suite

Sure, but will that mean 1.18 is no longer supported in all the tests ?

Only remove it for otelfiber. :-) But yes, it means we will have to release a major release for this middleware to drop support for go 1.18.x

Oh, I see what you mean... The tests CI is running all the middleware's in one place.

Indeed, changing that will drop 1.18 testing for all the others. Should we split the test action ? But I guess in case that would be another PR.

I'm thinking whats the best solution for this. In the storage repo every module has a separate file. We may need to do that for contrib

@ReneWerner87
Copy link
Member

ReneWerner87 commented Jun 26, 2023

pls increate the major number in the go.mod version

https://github.com/gofiber/contrib/blob/main/otelfiber/go.mod#L1 to

module github.com/gofiber/contrib/otelfiber/v2 and the readme instructions

@emanuelef can you resolve the conflicts with the master and add the "v2" prefix in the go.mod file

like here
gofiber/storage@ec921b8

@ReneWerner87
Copy link
Member

don´t forget the readme.md
image

@emanuelef
Copy link
Contributor Author

emanuelef commented Jun 27, 2023

Some questions:

  • will there be a changelog to explain why v2 was needed ?
  • how are we going to handle tests with different go versions for each module ?
  • do we need to add a coverage badge , so we know what percentage of the code is covered by the test ?
  • Is it ok to expose the metric constants ?

@ReneWerner87
Copy link
Member

will there be a changelog to explain why v2 was needed ?

yes the release notes for the tag

how are we going to handle tests with different go versions for each module ?

each test workflow has its own defined golang versions, so should not be a problem

do we need to add a coverage badge , so we know what percentage of the code is covered by the test ?

if that is possible and you can do that, gladly

Is it ok to expose the metric constants ?

is it conceivable that these are used outside? Then yes, otherwise I would not expose them

@emanuelef
Copy link
Contributor Author

so I guess the only reason for v2 is that minimum Go version is now 1.19 ?
Also I wasn't sure why that was needed.

@emanuelef
Copy link
Contributor Author

will there be a changelog to explain why v2 was needed ?

yes the release notes for the tag

how are we going to handle tests with different go versions for each module ?

each test workflow has its own defined golang versions, so should not be a problem

@gaby can you comment on that ? I can see the GH action is the same for all the other middlewares.

do we need to add a coverage badge , so we know what percentage of the code is covered by the test ?

if that is possible and you can do that, gladly

Is it ok to expose the metric constants ?

is it conceivable that these are used outside? Then yes, otherwise I would not expose them

@ReneWerner87
Copy link
Member

will there be a changelog to explain why v2 was needed ?

yes the release notes for the tag

how are we going to handle tests with different go versions for each module ?

each test workflow has its own defined golang versions, so should not be a problem

@gaby can you comment on that ? I can see the GH action is the same for all the other middlewares.

do we need to add a coverage badge , so we know what percentage of the code is covered by the test ?

if that is possible and you can do that, gladly

Is it ok to expose the metric constants ?

is it conceivable that these are used outside? Then yes, otherwise I would not expose them

good point, we need to split the test workflows like in the storage repository
https://github.com/gofiber/storage/tree/main/.github/workflows
thought that was already the case

otherwise we would customize the golang version for all contrib packages, but we don't want to do that

@gaby
Copy link
Member

gaby commented Jun 29, 2023

@emanuelef @ReneWerner87 I can do a separate PR to separate all the tests, then we can update this PR?

@ReneWerner87
Copy link
Member

ok

@gaby
Copy link
Member

gaby commented Jul 2, 2023

@emanuelef Test changes have been merged, you can rebase now :-)

@emanuelef
Copy link
Contributor Author

emanuelef commented Jul 3, 2023

@gaby I rebased and removed 1.18 from test-otelfiber.yml, but I can see 1.18 test still triggered. I might be missing something.

@emanuelef
Copy link
Contributor Author

ok, I've just had to delete test.yml in my PR.

@emanuelef emanuelef marked this pull request as ready for review July 3, 2023 09:21
@gaby gaby requested review from ReneWerner87 and efectn July 4, 2023 15:02
otelfiber/test/fiber_test.go Outdated Show resolved Hide resolved
@emanuelef
Copy link
Contributor Author

If users do not want to include a dependency on the default SDK it is recommended to run integration tests in their own module to isolate the dependency (see go.opentelemetry.io/otel/bridge/opencensus/test as an example).

Before closing, do we want to create a module just for the test to avoid including the tracetest dependency ?

@emanuelef
Copy link
Contributor Author

@ReneWerner87 is this PR not going to be merged because of the breaking changes ?

@ReneWerner87
Copy link
Member

sorry had been waiting for the changes for the test workflow and module and then lost focus for this pull request

@ReneWerner87 ReneWerner87 merged commit 5bc94d7 into gofiber:main Jul 31, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🤗 [Question]: Deprecation message opentelemetry
4 participants