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

Append traces path to http endpoint #279

Merged
merged 18 commits into from
Sep 28, 2022
Merged

Append traces path to http endpoint #279

merged 18 commits into from
Sep 28, 2022

Conversation

pkanal
Copy link
Contributor

@pkanal pkanal commented Sep 26, 2022

Which problem is this PR solving?

This PR adds the logic to append /v1/traces to the generic endpoint if the protocol specified is http/protobuf. It also refactors how fallback values are set and how environment values are set. This was necessary work in order to get the path to append properly for config values and env vars and overall allows us to test HoneycombOptions and EnvironmentOptions reliably.

Short description of the changes

  • Changed the way fallback values are set, they are no longer set in getters in HoneycombOptions and EnvironmentOptions. Removed fallback values and defaults altogether from EnvironmentOptions, they should be handled in one place in HoneycombOptions.
  • Moved environment variable overwriting to HoneycombOptions from EnvironmentOptions.
  • Append /v1/traces path to generic endpoint if the protocol is http/protobuf
  • Added lots of unit tests
  • Added logging out HoneycombOptions when Debug = true

@pkanal pkanal force-pushed the purvi/traces-path-http branch from b745799 to 73080ba Compare September 27, 2022 19:32
@pkanal pkanal changed the title Purvi/traces path http Append traces path to http endpoint Sep 27, 2022
@pkanal pkanal marked this pull request as ready for review September 27, 2022 19:45
@pkanal pkanal requested review from a team and MikeGoldsmith September 27, 2022 19:45
@pkanal pkanal self-assigned this Sep 27, 2022
@pkanal pkanal added the type: bug Something isn't working label Sep 27, 2022
@JamieDanielson JamieDanielson added the version: bump minor A PR that adds behavior, but is backwards-compatible. label Sep 28, 2022
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

This looks great, thanks @pkanal 🎉

Adds some feedback and suggestions plus some nits about whitespace 😄

src/Honeycomb.OpenTelemetry/HoneycombOptions.cs Outdated Show resolved Hide resolved
@@ -95,10 +97,12 @@ public static TracerProviderBuilder AddHoneycomb(this TracerProviderBuilder buil
if (options.Debug)
{
builder.AddConsoleExporter();
Console.WriteLine("DEBUG: HoneycombOptions");
Console.WriteLine(JsonSerializer.Serialize(options, new JsonSerializerOptions { WriteIndented = true }));
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @pkanal

I left one minor suggestion regarding local variable naming 😄

Copy link
Contributor

@JamieDanielson JamieDanielson left a comment

Choose a reason for hiding this comment

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

sometimes the right path is not the easiest one

@pkanal pkanal merged commit e9d6978 into main Sep 28, 2022
@pkanal pkanal deleted the purvi/traces-path-http branch September 28, 2022 17:56
pkanal added a commit that referenced this pull request Sep 29, 2022
## Which problem is this PR solving?
This PR follows up on #279 and adds the same logic to append
`/v1/metrics` path to the endpoint if the protocol is `http/protobuf` or
`http/json`

## Short description of the changes
- Adds smoke tests for metrics
- Consolidates tests with many cases using
[`InlineData`](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-dotnet-test#add-more-tests)
- Adds logic to append `/v1/metrics` to the generic endpoint if a path
is not already specified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working version: bump minor A PR that adds behavior, but is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Append /v1/traces to OTLP http/protobuf endpoint
4 participants