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 Console Activity Json Exporter #4548

Closed
wants to merge 3 commits into from

Conversation

brunomartinspro
Copy link

Changes

Added a Console Activity Json Exporter to output logs in JSON.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@brunomartinspro brunomartinspro requested a review from a team as a code owner June 6, 2023 09:34
Comment on lines 29 to 30
<PackageVersion Include="System.Text.Encodings.Web" Version="4.7.2" />
<PackageVersion Include="System.Text.Json" Version="4.7.2" />
<PackageVersion Include="System.Text.Encodings.Web" Version="7.0.0" />
<PackageVersion Include="System.Text.Json" Version="7.0.2" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? We should support the lowest possible version.

Copy link
Author

@brunomartinspro brunomartinspro Jun 6, 2023

Choose a reason for hiding this comment

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

that version did not support ReferenceHandler = ReferenceHandler.IgnoreCycles, should i remove it in favor of the version 4.7.2?

Directory.Packages.props Outdated Show resolved Hide resolved
@reyang
Copy link
Member

reyang commented Jun 6, 2023

What type of JSON do we use? I suggest that we start from https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md#json-protobuf-encoding (at least I want us to avoid inventing our own JSON format).


namespace OpenTelemetry.Exporter
{
public class ConsoleActivityJsonExporter : ConsoleExporter<Activity>
Copy link
Contributor

Choose a reason for hiding this comment

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

@brunomartinspro What's the motivation behind adding this new exporter to the repo? ConsoleExporter is a simple lightweight exporter meant for quick and naive testing/ troubleshooting for the developers. It was designed to be simple.

Copy link
Member

Choose a reason for hiding this comment

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

I think we just need an option to existing exporter to write json output

Copy link
Contributor

Choose a reason for hiding this comment

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

@cijothomas Why do we want to add this to the existing exporter though? Users are allowed to create their own custom exporters and use them.

Copy link
Member

Choose a reason for hiding this comment

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

Its good to support a more standard/predictable output in the consoleexporter, without forcing everyone to author their own exporter.
The predictable/standard output could be the https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md#json-protobuf-encoding OR could be the Prometheus exposition format for Metrics (there were issues asking for these earlier (this capability existed long back, but got removed), can't find it with my quick search)

Copy link
Contributor

Choose a reason for hiding this comment

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

Its good to support a more standard/predictable output in the consoleexporter, without forcing everyone to author their own exporter.

I definitely see value in standardizing the ConsoleExporter output. If we decide to go forward with this though, I think the implementation should meet certain requirements:

  • We want to keep ConsoleExporter simple, so I don't think we should make this an optional feature. Instead, we should simply update the existing behavior to output data in the standardized format
  • ConsoleExporter should not take any additional dependencies or bump the version of existing dependencies that might cause the user to run into version conflict issues with their application code

Copy link
Member

Choose a reason for hiding this comment

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

Agree with this.
It would also be good to add disclaimer that the output format could change (it has changed many times in the past) and people should not take dependency on it. (i.e use it for learning purposes, but not for production purposes to have telemetry output to stdout, and have some agent parse it to store telemetry)

<PackageVersion Include="System.Text.Encodings.Web" Version="4.7.2" />
<PackageVersion Include="System.Text.Json" Version="4.7.2" />
<PackageVersion Include="System.Text.Encodings.Web" Version="7.0.0" />
<PackageVersion Include="System.Text.Json" Version="7.0.2" />
Copy link
Member

Choose a reason for hiding this comment

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

What's the impact of this version bump? How many breaking changes would this introduce?

E.g. https://blog.georgekosmidis.net/net-6-a-guide-for-the-high-impact-breaking-changes.html

Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

@@ -26,11 +25,10 @@
<PackageVersion Include="StyleCop.Analyzers" Version="[1.2.0-beta.435,2.0)" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="7.0.0" />
<PackageVersion Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
<PackageVersion Include="System.Text.Encodings.Web" Version="4.7.2" />
<PackageVersion Include="System.Text.Json" Version="4.7.2" />
<PackageVersion Include="System.Text.Encodings.Web" Version="7.0.0" />
Copy link
Member

Choose a reason for hiding this comment

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

nit, indent

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day.

@github-actions github-actions bot added the Stale label Jun 15, 2023
@github-actions
Copy link
Contributor

Closed as inactive. Feel free to reopen if this PR is still being worked on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants