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

Make Steeltoe Metrics extensions play nice with Otel #848

Merged
merged 8 commits into from
May 25, 2022

Conversation

hananiel
Copy link
Contributor

@hananiel hananiel commented May 12, 2022

Final version:

  1. Calling AddAllActuators will do everything for you including configuring OpenTelemetry metrics and Otels methods do not have to be invoked.
  2. But if you call Otel's extension method and provide custom configuration and then call AddOpenTelemetryMetricsForSteeltoe via AddAllActuators, a warning is written to Console and Steeltoe configuration will be ignored. Calling metrics, prometheus will not produce any metrics, and a warning will be logged.
  3. If you call Steeltoe AddAllActuators first, and then call Otel via AddOpenTelemetryMetrics, Otel configuration will take precedence and Steeltoe configuration will be ignored. There will be no warning, because we don't have an opportunity to detect this. Calling metrics, prometheus will not produce any metrics, and a warning will be logged.
  4. There is now an option to Configure steeltoe metrics with any custom Otel configuration:
 var host = hostBuilder
                .ConfigureServices(services => services.AddOpenTelemetryMetrics(
                    builder => builder
                    .ConfigureSteeltoeMetrics()
                    .AddConsoleExporter()))
                .AddAllActuators()
                .Start();

This will start logging Steeltoe Observer metrics to console and prometheus and metrics endpoints will work correctly.

@hananiel hananiel requested a review from TimHess May 12, 2022 21:43
@hananiel hananiel self-assigned this May 12, 2022
@hananiel hananiel added this to the 3.2.0 milestone May 12, 2022
@hananiel hananiel added the Component/Management Issues related to Steeltoe Management (actuators) label May 12, 2022
@hananiel hananiel marked this pull request as ready for review May 24, 2022 14:17
@hananiel hananiel requested a review from TimHess May 24, 2022 14:17
@TimHess
Copy link
Member

TimHess commented May 25, 2022

/azp run Steeltoe.All

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sonarcloud
Copy link

sonarcloud bot commented May 25, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

69.2% 69.2% Coverage
0.0% 0.0% Duplication

@hananiel hananiel merged commit 44a87f2 into main May 25, 2022
@hananiel hananiel deleted the SteeltoeMetrics_OtelCompatibility branch May 25, 2022 20:46
@TimHess TimHess mentioned this pull request Aug 16, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component/Management Issues related to Steeltoe Management (actuators)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants