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

Feature/provider config #75

Merged
merged 21 commits into from
Aug 22, 2024
Merged

Feature/provider config #75

merged 21 commits into from
Aug 22, 2024

Conversation

vincentfree
Copy link
Owner

Add a provider library that simplifies the process of creating the providers for otel instrumentation libraries.

The library provides a New function to create a new provider instance. With this instance you can easily inject a provider.

The Idea is to reduce boilerplate code in projects and make it easier on developers.

Example of the usage of the lib:

provider := providerconfig.New(
	providerconfig.WithApplicationName("example-app"),
	providerconfig.WithApplicationVersion("0.1.0"),
	providerconfig.WithExecutionType(providerconfig.Async),
	providerconfig.WithSignalProcessor(providerconfignoop.NewNoopProcessor()),
)

// traces
otel.SetTracerProvider(provider.TraceProvider())

// metrics
otel.SetMeterProvider(provider.MetricProvider())

// logs
global.SetLoggerProvider(provider.LogProvider())

Instead of the Noop processor, there are two other signal processors available, one for http and the other for grpc.

These are available through:

  • github. com/ vincentfree/ opentelemetry/ providerconfiggrpc
  • github. com/ vincentfree/ opentelemetry/ providerconfighttp

These can be used as follows:

signalProcessor := providerconfiggrpc.New(
		providerconfiggrpc.WithCollectorEndpoint("0.0.0.0", 8888),
)
provider := providerconfig.New(providerconfig.WithApplicationName("example-app"),
	providerconfig.WithApplicationVersion("0.1.0"),
	providerconfig.WithSignalProcessor(signalProcessor),
)

Reworked logging library to support more flexible configurations via LogOption, including setting custom handlers and enabling/disabling the OpenTelemetry bridge. Updated functions to align with the new logger structure and deprecated older methods.

Signed-off-by: Vincent Free <[email protected]>
Introduce new config helper for tracing, logging, and metrics. This includes initializing OTLP exporters, configuring providers, and handling shutdown logic for various telemetry signals.

Signed-off-by: Vincent Free <[email protected]>
Introduced `providerconfig` package with hooks, processors, and execution types. Added a Noop processor implementation and integrated new OpenTelemetry dependencies, replacing obsolete ones.

Signed-off-by: Vincent Free <[email protected]>
Refactored provider configuration to use a new Provider interface, replacing the existing OtelConfig structure. Added Apache 2.0 license headers to all files, ensuring proper usage and distribution compliance.

Signed-off-by: Vincent Free <[email protected]>
This commit incorporates Apache License Version 2.0 headers into the README.md and noop_processor.go files for compliance and legal clarity. Additionally, it updates the import path in noop_processor.go for proper dependency management.

Signed-off-by: Vincent Free <[email protected]>
Each source file now includes Apache 2.0 license headers to ensure compliance and clarify licensing terms. This change affects multiple files across different packages.

Signed-off-by: Vincent Free <[email protected]>
Reworked logging library to support more flexible configurations via LogOption, including setting custom handlers and enabling/disabling the OpenTelemetry bridge. Updated functions to align with the new logger structure and deprecated older methods.

Signed-off-by: Vincent Free <[email protected]>
Introduce new config helper for tracing, logging, and metrics. This includes initializing OTLP exporters, configuring providers, and handling shutdown logic for various telemetry signals.

Signed-off-by: Vincent Free <[email protected]>
Introduced `providerconfig` package with hooks, processors, and execution types. Added a Noop processor implementation and integrated new OpenTelemetry dependencies, replacing obsolete ones.

Signed-off-by: Vincent Free <[email protected]>
Refactored provider configuration to use a new Provider interface, replacing the existing OtelConfig structure. Added Apache 2.0 license headers to all files, ensuring proper usage and distribution compliance.

Signed-off-by: Vincent Free <[email protected]>
This commit incorporates Apache License Version 2.0 headers into the README.md and noop_processor.go files for compliance and legal clarity. Additionally, it updates the import path in noop_processor.go for proper dependency management.

Signed-off-by: Vincent Free <[email protected]>
Each source file now includes Apache 2.0 license headers to ensure compliance and clarify licensing terms. This change affects multiple files across different packages.

Signed-off-by: Vincent Free <[email protected]>
Mark `SetLogOptions` and `NewWithHandler` as deprecated and suggest the usage of the `New` function for improved logging functionality. Update `New` and deprecation comments for clarity.
Signed-off-by: Vincent Free <[email protected]>
Signed-off-by: Vincent Free <[email protected]>
Switched from golang.org/x/exp/slog to log/slog. Enhanced logging with otelzerolog for accurate context tracing in benchmarks and main application.

Signed-off-by: Vincent Free <[email protected]>
Updated `go.sum` and `go.mod` to include new versions of various dependencies, including `go.opentelemetry.io/contrib`, `golang.org/x/exp`, and `golang.org/x/sys`. Also modified indirect references and added local paths for `otellogrus` and `otelzerolog`.

Signed-off-by: Vincent Free <[email protected]>
@vincentfree vincentfree merged commit 1feefe7 into main Aug 22, 2024
7 checks passed
@vincentfree vincentfree deleted the feature/provider-config branch August 22, 2024 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant