Skip to content

Conversation

@mattsains
Copy link
Contributor

@mattsains mattsains commented Nov 20, 2025

This is a re-submission of #3367 , after @cijothomas recommend that it should be re-introduced.

I did change the name of the config option to WithResourceAttributes to match the Rust option in the user events log exporter

I also changed the logic when this field is not provided. The default is now to include no resource attributes except for mapped fields (eg., service.name -> Part A cloud extension)

Changes

Allows users of the Geneva exporter to specify which resource attributes they want sent to Geneva. This prevents excessive trace data from being exported if there are many resource attributes which do not need to be stored.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, 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)

@github-actions github-actions bot added the comp:exporter.geneva Things related to OpenTelemetry.Exporter.Geneva label Nov 20, 2025
/// WantedResourceAttributes specifies which resource attribute fields should be sent to Geneva.
///
/// Any resource attributes not in WantedResourceAttributes are ignored.
/// If WantedResourceAttributes is not provided, all resource attributes will be sent to Geneva.
Copy link
Member

Choose a reason for hiding this comment

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

all will be sent or none will be sent?

Copy link
Member

Choose a reason for hiding this comment

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

In my opinion, it should be none, so the behavior is back-compatible. To get resource attributes, users must explicitly opt-in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if a customer really wants all resource attributes, how might they accomplish that? By the way, there is a feature flag which is default off that controls this feature

Copy link
Contributor Author

@mattsains mattsains Nov 20, 2025

Choose a reason for hiding this comment

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

I've made the change you requested

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you think the special resource attributes, service.name and service.instanceId, which are mapped to part A cloud extension, should also be affected by WithResourceAttributes being set to null?

Copy link
Member

Choose a reason for hiding this comment

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

By the way, there is a feature flag which is default off that controls this feature

I am not sure if we need to feature flag this at all. The WithResourceAttribute is sufficient on its own right?

if a customer really wants all resource attributes, how might they accomplish that?

By listing each attribute. Not ideal, but I also don't think this will be the common case with GenevaExporter. If there is strong need for such a capability, we can introduce a boolean 'with_all_resource`/similar that adds all attributes effectively ignore WithResourceAttributes. Alternatively, "*" can be used to mean - get all attributes - we do such thing elsewhere in GenevaExporter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can remove the feature flag in a future PR

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

❌ Patch coverage is 94.44444% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.20%. Comparing base (48d18f6) to head (5255e5d).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...er.Geneva/Internal/MsgPack/MsgPackTraceExporter.cs 95.08% 3 Missing ⚠️
...Telemetry.Exporter.Geneva/GenevaExporterOptions.cs 87.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3552      +/-   ##
==========================================
- Coverage   71.22%   71.20%   -0.02%     
==========================================
  Files         442      442              
  Lines       17516    17520       +4     
==========================================
  Hits        12475    12475              
- Misses       5041     5045       +4     
Flag Coverage Δ
unittests-Exporter.Geneva 53.73% <94.44%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...enTelemetry.Exporter.Geneva/GenevaTraceExporter.cs 82.05% <100.00%> (-0.45%) ⬇️
...xporter.Geneva/Internal/ConnectionStringBuilder.cs 92.85% <ø> (-0.15%) ⬇️
...rter.Geneva/Internal/MsgPack/MsgPackLogExporter.cs 92.37% <100.00%> (+0.06%) ⬆️
...Telemetry.Exporter.Geneva/GenevaExporterOptions.cs 89.18% <87.50%> (-1.06%) ⬇️
...er.Geneva/Internal/MsgPack/MsgPackTraceExporter.cs 93.31% <95.08%> (-0.83%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mattsains mattsains marked this pull request as ready for review November 20, 2025 18:57
@mattsains mattsains requested a review from a team as a code owner November 20, 2025 18:57
@Kielek Kielek changed the title Opt in resources [Exporter.Geneva] Opt in resources Nov 21, 2025
}
}

if (!isDedicatedField && (this.WithResourceAttributes == null || !this.WithResourceAttributes.Contains(entry.Key)))
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we short-circuit this entire method if this.WithResourceAttributes == null ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided that service.name and service.instanceId fields should still be used even if they're not explicitly mentioned in WithResourceAttributes, because they have a special mapping into part A cloud extension. So I don't believe the code should skip this section if it is one of those two resource attributes

/// Any resource attributes not in WithResourceAttributes are ignored.
/// If WithResourceAttributes is not provided, no resource attributes will be sent to Geneva.
/// </summary>
public IEnumerable<string>? WithResourceAttributes { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

nit: is this still controlled by a feature flag in connection string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

please refer to this previous conversation: #3552 (comment)

/// Any resource attributes not in WithResourceAttributes are ignored.
/// If WithResourceAttributes is not provided, no resource attributes will be sent to Geneva.
/// </summary>
public IEnumerable<string>? WithResourceAttributes { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Should this be --> public IEnumerable? WithResourceAttributes { get; init; }

Also, AllowedResourceAttributes or ResourceAttributeFilter naming might fit better here. No strong preference will leave it to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure - would you like me to do the same to PrepopulatedFields?

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

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 label Dec 4, 2025
@github-actions github-actions bot removed the Stale label Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:exporter.geneva Things related to OpenTelemetry.Exporter.Geneva

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants