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

[service] Move TracerProvider initialization to service/telemetry package #8171

Closed

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Aug 3, 2023

Description:

Moves TracerProvider initialization to service/telemetry package. To do this while avoiding duplicated code and import cycles I also had to:

  • Create new service/internal/resource package to handle resource creation.
  • Moves some parts of tracer provider initialization to service/telemetry from service/internal/proctelemetry and service.

A second PR will move the meter provider initialization to service/telemetry for consistency.

Link to tracking Issue: Updates #8170

@mx-psi mx-psi added area:service collector-telemetry healthchecker and other telemetry collection issues Skip Changelog PRs that do not require a CHANGELOG.md entry labels Aug 3, 2023
@mx-psi mx-psi requested a review from codeboten August 3, 2023 15:10
@mx-psi mx-psi marked this pull request as ready for review August 3, 2023 15:12
@mx-psi mx-psi requested a review from a team as a code owner August 3, 2023 15:12
@mx-psi mx-psi force-pushed the mx-psi/refactor-service-telemetry branch from 7ea601a to 28300f1 Compare August 3, 2023 15:26
Comment on lines +47 to +48
// needed for supporting the zpages extension
sdktrace.WithSampler(alwaysRecord()),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not present on service/telemetry.go, but was present on service/telemetry/telemetry.go initialization logic, so I added it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be available as an option in the function, since zpages will always want this on, but users will want the ability to configure their own samplers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be available as an option in the function, since zpages will always want this on, but users will want the ability to configure their own samplers

By "an option in the function" you mean an option in newTracerProvider? Would this option be exposed to end users?

@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Attention: 30 lines in your changes are missing coverage. Please review.

Files Coverage Δ
service/internal/proctelemetry/config.go 96.75% <100.00%> (+0.37%) ⬆️
service/internal/resource/config.go 100.00% <100.00%> (ø)
service/telemetry/config.go 100.00% <ø> (ø)
service/telemetry.go 75.42% <50.00%> (+5.88%) ⬆️
service/service.go 70.27% <62.50%> (-4.45%) ⬇️
service/telemetry/telemetry.go 95.00% <40.00%> (-5.00%) ⬇️
service/telemetry/span_processor.go 95.53% <95.53%> (ø)
service/telemetry/tracer_provider.go 43.33% <43.33%> (ø)

... and 1 file with indirect coverage changes

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall i think this is an improvement, there are some conflicts that will need resolving

Comment on lines +47 to +48
// needed for supporting the zpages extension
sdktrace.WithSampler(alwaysRecord()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be available as an option in the function, since zpages will always want this on, but users will want the ability to configure their own samplers

Comment on lines +16 to +23
// supported protocols for exporters
const (
// ProtocolProtobufHTTP is the OTLP/HTTP with Protobuf encoding protocol
ProtocolProtobufHTTP = "http/protobuf"
// ProtocolProtobufGRPC is the OTLP/gRPC protocol
ProtocolProtobufGRPC = "grpc/protobuf"
)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now exposed by this package. I think it makes sense to expose it given it is part of the public API

Comment on lines +22 to +28
// NormalizeEndpoint takes an HTTP(s) endpoint and adds the protocol prefix if missing.
func NormalizeEndpoint(endpoint string) string {
if !strings.HasPrefix(endpoint, "https://") && !strings.HasPrefix(endpoint, "http://") {
return fmt.Sprintf("http://%s", endpoint)
}
return endpoint
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now exposed by this package and imported by service/internal/proctelemetry. I am not sure if this makes sense and want some feedback on this. Should we move this to a package in service/internal? Should this be a public method on the Otlp configuration struct instead?

cc @codeboten

@mx-psi
Copy link
Member Author

mx-psi commented Sep 6, 2023

For those following at home, this is blocked by open-telemetry/opentelemetry-go-contrib/pull/4228 after offline conversation with Alex.

This will solve the comments above

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Sep 21, 2023
@mx-psi mx-psi removed the Stale label Sep 21, 2023
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Oct 14, 2023
@mx-psi
Copy link
Member Author

mx-psi commented Oct 16, 2023

Waiting on #8620

@github-actions github-actions bot removed the Stale label Oct 17, 2023
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Oct 31, 2023
@mx-psi mx-psi removed the Stale label Nov 3, 2023
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Nov 22, 2023
Copy link
Contributor

github-actions bot commented Dec 7, 2023

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Dec 7, 2023
codeboten pushed a commit that referenced this pull request Jan 30, 2024
…kage (#9384)

Second redo of
#8171 that
does not depend on
#9131

Link to tracking Issue: Updates
#8170

---------

Co-authored-by: Alex Boten <aboten@lightstep.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:service collector-telemetry healthchecker and other telemetry collection issues Skip Changelog PRs that do not require a CHANGELOG.md entry Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants