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

feat(trace-exporter): use the same resource mapping for metrics and traces #635

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function transformResourceToAttributes(
resourceFilter?: RegExp,
stringifyArrayAttributes?: boolean
): Attributes {
const monitoredResource = mapOtelResourceToMonitoredResource(resource, true);
const monitoredResource = mapOtelResourceToMonitoredResource(resource);
const attributes: ot.SpanAttributes = {};

if (resourceFilter) {
Expand Down
19 changes: 14 additions & 5 deletions packages/opentelemetry-resource-util/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,22 @@ export interface MonitoredResource {
* https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/internal/resourcemapping/resourcemapping.go#L51
*
* @param resource the OTel Resource
* @param includeUnsupportedResources if true, will return the most specific monitored resource
* possible even if that resource does not support custom metrics. If false, will fallback to
* generic resources which support custom metrics. See
* https://cloud.google.com/monitoring/custom-metrics for more information on which resources
* supporting custom metrics.
* @returns the corresponding GCM MonitoredResource
*/
export function mapOtelResourceToMonitoredResource(
resource: IResource
): MonitoredResource;
/**
* @deprecated This overload is deprecated, do not pass the includeUnsupportedResources boolean
* parameter. It will be removed in the next major version release.
*
* @param resource the OTel Resource
* @returns the corresponding GCM MonitoredResource
*/
export function mapOtelResourceToMonitoredResource(
resource: IResource,
includeUnsupportedResources: boolean | undefined
): MonitoredResource;
export function mapOtelResourceToMonitoredResource(
resource: IResource,
includeUnsupportedResources = false
Expand Down