Opentelemetry-dotnet: OTLP Exporter Help

Created on 12 Feb 2021  路  9Comments  路  Source: open-telemetry/opentelemetry-dotnet

Question

Describe your environment.

TargetFramework: netcoreapp3.1
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

FYI -- I've also used more recent versions and got the same behavior

What are you trying to achieve?
I'd like to use the OTLP exporter to post the captured telemetry data to a custom endpoint I built.

What did you expect to see?
Expect to see the open telemetry data being posted to the endpoint I specify when configuring the SDK.

Additional Context

Here's the piece of code I'm using at this point

services.AddOpenTelemetryTracing((builder) =>
{
    builder
    .AddAspNetCoreInstrumentation()
    .AddHttpClientInstrumentation()
    .AddOtlpExporter(otlpOptions =>
    {
        otlpOptions.Endpoint = "http://localhost:4000/";
    });
});

In a nutshell, the above is pretty straightforward and I picked that up from docs but turns that it doesn't post the data to the specified endpoint, and looking into the docs/code I couldn't identify the reason why that has been happening 馃槥

Another interesting thing: I've been seeing the following exception being printed into the console which leads me to think that's related to the post OTLP is trying to accomplish.

Exception generated: 'System.InvalidOperationException' em System.Private.CoreLib.dll
Exception generated: 'Grpc.Core.RpcException' em System.Private.CoreLib.dll

I feel that it's a simple thing that I'm not being able to identify/see. Hope I can get some help from here and happy to help improve the docs to make that clear for someone else that face the same 馃憤

question

All 9 comments

Please upgrade to the 1.0.1 version and see if it helps.
Also which environment were you running this? (docker image name etc.)

@zfael Please ensure that you have configured the port forwarding to container's port 4317 on docker run. If you're using "http://localhost:4000/" as your endpoint then you should configure the docker run accordingly to use -p 4000:4317. For e.g.
docker run --rm -it -p 4000:4317 -v "%cd%":/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/otlp-collector-example/config.yaml

hey @cijothomas @utpilla , so I've bumped the packages to the following but still not able to see the otl data being sent through

TargetFramework: netcoreapp3.1

[email protected]"
[email protected]"
[email protected]"
[email protected]"
[email protected]"
[email protected]"

NOTE: After bump to the above I started seeing only the following exception:
exception generated: 'Grpc.Core.RpcException' em System.Private.CoreLib.dll

a bit more context on my environment:
1) I have got an HTTP POST endpoint running on the AWS API gateway. Something similar to this
https://xxxxxx.execute-api.region.amazonaws.com/dev/otl
2) that endpoint is pretty simple, just accept the data, log and return a 200 status code.
3) then, I have the weather forecast project running on my local that has the OpenTelemetry C# configured like on the Issue description.
4) that makes an outbound call to https://postman-echo.com/post and I was expecting that to be captured (which is being captured, I saw that on console exporter) and being sent out to the configured custom exporter.

let me know if you guys need any other information and I'm happy to get that 鉁旓笍

@zfael You say you've built a custom endpoint. You are not using the OpenTelemetry Collector? If not, there may be an issue with your endpoint and not the exporter. Note that the exporter currently only supports gRPC.

@alanwest I'm not using the OpenTelemetry Collector, yea!
so you are saying that a regular HTTP endpoint would not properly fit as a target for the OtlpExporter exporter? I was really under the impression that it could be accomplishable馃

@zfael If you just want to send traces to a regular HTTP endpoint, you could use InMemoryExporter which takes in a collection that would be populated with the traces. You could then use this collection and make a POST request to your custom endpoint.

so you are saying that a regular HTTP endpoint would not properly fit as a target for the OtlpExporter exporter?

Correct, while OTLP supports both HTTP and gRPC, currently the .NET OTLP exporter only has support for gRPC. Regular HTTP support will be added in the future.

alright! that makes sense, thanks @alanwest

@utpilla - in fact, while reading your comment that made me realize that I can come up with a custom exporter, like MyCustomExporter, where I'd just normalize the info produced by OpenTelemetry and then post to my Endpoint, thanks for bringing this up!

Closing this up since its accomplishable by a custom exporter or by using the InMemory built-in exporter, thank y'll

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ddiaz-relativity picture ddiaz-relativity  路  4Comments

Rast1234 picture Rast1234  路  3Comments

reyang picture reyang  路  5Comments

reyang picture reyang  路  5Comments

bruno-garcia picture bruno-garcia  路  5Comments