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

Add OTLP exporter integration test #1671

Merged

Conversation

alanwest
Copy link
Member

Adds a basic integration test for the OTLP exporter. Provides a starting place to expand the test coverage further. I'd like to land this PR and integrate it into #1662. This will enable testing SuppressInstrumentation and validating that #1662 fixes #1251.

@alanwest alanwest requested a review from a team December 23, 2020 00:15
@codecov
Copy link

codecov bot commented Dec 23, 2020

Codecov Report

Merging #1671 (808ae2f) into master (3bb0445) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1671   +/-   ##
=======================================
  Coverage   82.06%   82.06%           
=======================================
  Files         249      249           
  Lines        6730     6730           
=======================================
  Hits         5523     5523           
  Misses       1207     1207           
Impacted Files Coverage Δ
...us/Implementation/PrometheusExporterEventSource.cs 63.63% <0.00%> (-9.10%) ⬇️
...ter.ZPages/Implementation/ZPagesActivityTracker.cs 100.00% <0.00%> (+2.85%) ⬆️

}
}

public static string GetEnvironmentVariable(string environmentVariableName)
Copy link
Member

Choose a reason for hiding this comment

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

I was going to say you could call SkipUnlessEnvVarFoundTheoryAttribute.GetEnvironmentVariable to achieve some code reuse but then you would have to also include that file in the project which kind of sucks. Probably the duplication is better. So I guess what I'm saying is, nice job 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea I had some similar thoughts then opted for duplication. We could play around with organizing things like this into a "xUnit extensions" namespace and then you could do something like

<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests\xunit\**" />

Copy link
Member

@CodeBlanch CodeBlanch left a comment

Choose a reason for hiding this comment

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

LGTM

{
var exporterOptions = new OtlpExporterOptions
{
Endpoint = CollectorEndpoint,
Copy link
Member

Choose a reason for hiding this comment

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

Since #1662 is merged, we need to conditionally use Uri/String here.

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

Approved, need to fix the build issue before merging.

@CodeBlanch
Copy link
Member

Fix build part 4 - third time's not the charm.

LOL

<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net46</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == ''">netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) == '' AND $(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net46</TargetFrameworks>
<TargetFrameworks Condition="$(TARGET_FRAMEWORK) != ''">$(TARGET_FRAMEWORK)</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

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

This third line seems kind of redundant 🤷

Copy link
Member

Choose a reason for hiding this comment

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

Maybe not. This is basically allowing $(TARGET_FRAMEWORK) to override what is in csproj? So you can pass it on the command-line?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, TARGET_FRAMEWORK is a property that is set when building the project for running the integration tests

RUN dotnet publish "OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true -p:TARGET_FRAMEWORK=${PUBLISH_FRAMEWORK}

@cijothomas cijothomas merged commit 2385904 into open-telemetry:master Jan 14, 2021
@alanwest alanwest deleted the alanwest/otlp-integration-test branch March 9, 2021 18:46
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.

Can't use OtlpExporter in an Alpine docker image
4 participants