Skip to content
2 changes: 1 addition & 1 deletion packages/opentelemetry-host-metrics/src/BaseMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface MetricsCollectorConfig {
url?: string;
}

const DEFAULT_NAME = 'opentelemetry-host-metrics';
const DEFAULT_NAME = '@opentelemetry/host-metrics';
Copy link
Member

Choose a reason for hiding this comment

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

This could be potentially a breaking change if someone is already relying on this, we should mention that in the changelog

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIUC the changelog will automatically get this PR title added to it for the next release. However,

  1. that doesn't include the explicit strings, so won't be as helpful as possible.
  2. Do you think I should add the bang (feat(host-metrics)!: ...) so that this gets added to the "breaking change" section and triggers a new major version (0.34.0)?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think 0.34.0 should be used for next release.

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've updated the PR title to add the !. I hope that is sufficient -- i.e. that the PR title and not the original comment message title is used.


/**
* Base Class for metrics
Expand Down
8 changes: 7 additions & 1 deletion packages/opentelemetry-host-metrics/test/metric.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ describe('Host Metrics', () => {

hostMetrics = new HostMetrics({
meterProvider,
name: 'opentelemetry-host-metrics',
name: '', // to get default instrumentation scope name
});

await hostMetrics.start();

const dateStub = sandbox
Expand Down Expand Up @@ -341,6 +342,11 @@ async function getRecords(
assert(collectionResult != null);
assert.strictEqual(collectionResult.resourceMetrics.scopeMetrics.length, 1);
const scopeMetrics = collectionResult.resourceMetrics.scopeMetrics[0];
assert.strictEqual(
scopeMetrics.scope.name,
'@opentelemetry/host-metrics',
'default instrumentation scope name is the package name'
);
const metricDataList = scopeMetrics.metrics.filter(
metric => metric.descriptor.name === name
);
Expand Down