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

Metrics SDK does not comply with Service/Telemetry SDK semantic conventions #3410

Closed
pichlermarc opened this issue Nov 14, 2022 · 2 comments · Fixed by #3411
Closed

Metrics SDK does not comply with Service/Telemetry SDK semantic conventions #3410

pichlermarc opened this issue Nov 14, 2022 · 2 comments · Fixed by #3411
Assignees
Labels
bug Something isn't working priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect

Comments

@pichlermarc
Copy link
Member

What happened?

Steps to Reproduce

Setup Metrics SDK and export data anywhere.

Expected Result

Similar to the Trace SDK, I expected that Resource includes the attributes listed in the Service Semantic Conventions and Telemetry SDK Semantic Conventions, which state that:

  • service.name is REQUIRED
  • telemetry.sdk.name is RECOMMENDED
  • telemetry.sdk.language is RECOMMENDED
  • telemetry.sdk.versionis RECOMMENDED

Actual Result

Resource is empty.

OpenTelemetry Setup Code

'use strict';

const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');
const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');

const metricExporter = new OTLPMetricExporter({});
const meterProvider = new MeterProvider({});

meterProvider.addMetricReader(new PeriodicExportingMetricReader({
  exporter: metricExporter,
  exportIntervalMillis: 1000,
}));

const meter = meterProvider.getMeter('my-meter');
const counter = meter.createCounter('counter');

setInterval(() => {
  counter.add(1);
}, 1000);


// Collector config for logging the metrics:
receivers:
  otlp:
    protocols:
      grpc:

exporters:
  logging:
    loglevel: "debug"

service:
  pipelines:
    metrics:
      receivers: [otlp]
      exporters: [logging]

package.json

{
  "name": "semconv-bug-repro",
  "scripts": {
    "start:metrics": "node metrics.js"
  },
  "author": "OpenTelemetry Authors",
  "license": "Apache-2.0",
  "dependencies": {
    "@opentelemetry/api": "^1.3.0",
    "@opentelemetry/exporter-metrics-otlp-grpc": "0.34.0",
    "@opentelemetry/sdk-metrics": "1.8.0"
  }
}

Relevant log output

Resource SchemaURL: 
 ScopeMetrics #0
 ScopeMetrics SchemaURL: 
 InstrumentationScope my-meter 
 Metric #0
 Descriptor:
      -> Name: counter
      -> Description: 
      -> Unit: 
      -> DataType: Sum
      -> IsMonotonic: true
      -> AggregationTemporality: AGGREGATION_TEMPORALITY_CUMULATIVE
 NumberDataPoints #0
 StartTimestamp: 2022-11-14 10:31:06.026851072 +0000 UTC
 Timestamp: 2022-11-14 10:37:36.361387264 +0000 UTC
 Value: 390.000000
@pichlermarc pichlermarc added bug Something isn't working triage labels Nov 14, 2022
@pichlermarc
Copy link
Member Author

I'm working on a fix for this 🙂

@pichlermarc pichlermarc self-assigned this Nov 14, 2022
@dyladan dyladan added priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect and removed triage labels Nov 14, 2022
@dyladan
Copy link
Member

dyladan commented Nov 14, 2022

Please add priority labels when you can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants