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

Support for Activity Status and StatusDescription via switch #2605

Conversation

vishweshbankwar
Copy link
Member

@vishweshbankwar vishweshbankwar commented Nov 12, 2021

Fixes 2. under proposal in #2569

Todo:
Doc update.
Update #2572 to consider this change.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Design discussion issue #
  • Changes in public API reviewed

@codecov
Copy link

codecov bot commented Nov 12, 2021

Codecov Report

Merging #2605 (562a898) into main (05cdc2c) will increase coverage by 0.05%.
The diff coverage is 95.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2605      +/-   ##
==========================================
+ Coverage   81.31%   81.37%   +0.05%     
==========================================
  Files         245      247       +2     
  Lines        8645     8686      +41     
==========================================
+ Hits         7030     7068      +38     
- Misses       1615     1618       +3     
Impacted Files Coverage Δ
src/OpenTelemetry/BackwardCompatibilityHelper.cs 91.66% <91.66%> (ø)
src/OpenTelemetry.Api/Internal/StatusHelper.cs 100.00% <100.00%> (ø)
src/OpenTelemetry/BackwardCompatibilitySwitches.cs 100.00% <100.00%> (ø)
src/OpenTelemetry/BaseExportProcessor.cs 88.46% <100.00%> (+2.09%) ⬆️
src/OpenTelemetry/BatchActivityExportProcessor.cs 100.00% <100.00%> (ø)
src/OpenTelemetry/SimpleActivityExportProcessor.cs 100.00% <100.00%> (ø)
...Telemetry/Internal/SelfDiagnosticsEventListener.cs 96.87% <0.00%> (-0.79%) ⬇️

/// </summary>
/// <param name="tracerProviderBuilder">TracerProviderBuilder instance.</param>
/// <returns>Returns <see cref="TracerProviderBuilder"/> for chaining.</returns>
public static TracerProviderBuilder DisableActivityStatusSwitch(this TracerProviderBuilder tracerProviderBuilder)
Copy link
Member

Choose a reason for hiding this comment

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

Since the switch is static (global), we might want to just expose it statically. Kind of like we do for the global propagator. I think having these extensions on TracerProviderBuilder might mislead users into thinking the setting is per-tracer.

/// If true then activity Status and StatusDescription properties will be set
/// using tags otel.status_code and otel.status_description respectively.
/// </summary>
public static bool ActivityStatusSwitch { get; set; } = true;
Copy link
Member

Choose a reason for hiding this comment

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

Trying to think of a more descriptive name. How about "StatusTagMigrationEnabled"?

I think for the comments something like...

        /// <summary>
        /// Gets or sets a value indicating whether or not activity status migration is enabled. Default value: true.
        /// </summary>
        /// <remarks>
        /// If true then <see cref="Activity.Status"/> and <see cref="Activity.StatusDescription"/> properties (added in .NET 6) will be set
        /// from `otel.status_code` and `otel.status_description` tag values respectively prior to export. For more details see <a href="migration_doc_url_here">migration doc name here</a>.
        /// </remarks>

Copy link
Member Author

@vishweshbankwar vishweshbankwar Nov 17, 2021

Choose a reason for hiding this comment

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

Done - let me know if you have a suggestion for class name as well :)

@vishweshbankwar vishweshbankwar changed the title [WIP] Support for Activity Status and StatusDescription via switch Support for Activity Status and StatusDescription via switch Nov 17, 2021
@vishweshbankwar vishweshbankwar changed the title Support for Activity Status and StatusDescription via switch Support for Activity Status and StatusDescription in SDK Nov 17, 2021
@vishweshbankwar vishweshbankwar changed the title Support for Activity Status and StatusDescription in SDK Support for Activity Status and StatusDescription via switch Nov 17, 2021
@vishweshbankwar vishweshbankwar marked this pull request as ready for review November 17, 2021 03:52
@vishweshbankwar vishweshbankwar requested a review from a team November 17, 2021 03:52
@@ -47,6 +48,16 @@ public sealed override void OnStart(T data)

public override void OnEnd(T data)
{
var activity = data as Activity;
Copy link
Member

Choose a reason for hiding this comment

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

this will add unwanted perf impact, when using LogRecord.
I think we need to add BaseActivityExportProcessor, which inherits BaseExportProcessor<Activity>.

Copy link
Member Author

Choose a reason for hiding this comment

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

It will be same as SimpleActivityExportProcessor and BatchActivityExportProcessor right?
The reason we wanted to put it here is to cover cases where exporters are inheriting from BaseExportProcessor and not overriding OnEnd.

Instead of introducing new one - should we add this check in Batch and Simple Activity processor (this is what I had before).

@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale Issues and pull requests which have been flagged for closing due to inactivity label Jan 28, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2022

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
Stale Issues and pull requests which have been flagged for closing due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants