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

Unable to see Grpc Metrics being emitted by ConsoleMetricExporter for a GRPC Client that is continuously making Unary Calls #5249

Closed
1 task
rathsai opened this issue Dec 10, 2024 · 2 comments

Comments

@rathsai
Copy link

rathsai commented Dec 10, 2024

Hi,

I have been trying to see metrics printed for instruments like grpc.client.attempt. duration, grpc.client.call.duration , etc as per mentioned in the doc: https://grpc.io/docs/guides/opentelemetry-metrics/#client-per-attempt-instruments

However, I have been trying to set this up multiple times and haven't been able to. My sample instrumentation file contains

import { NodeSDK } from '@opentelemetry/sdk-node'
import {
  ConsoleMetricExporter,
  PeriodicExportingMetricReader,
} from '@opentelemetry/sdk-metrics'
import {GrpcInstrumentation} from "@opentelemetry/instrumentation-grpc";

// For troubleshooting, set the log level to DiagLogLevel.DEBUG
// import {diag, trace, DiagConsoleLogger, DiagLogLevel} from "@opentelemetry/api";
// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.VERBOSE)


const openTelemetrySDK = new NodeSDK({
  metricReader: new PeriodicExportingMetricReader({
    exporter: new ConsoleMetricExporter(),
    exportIntervalMillis: 1000
  }),
  instrumentations: [
    new GrpcInstrumentation({
      enabled: true
    })
  ]
})

// This method monkey patches the grpc client classes and injects the OpenTelemetry methods.
openTelemetrySDK.start()

process.on('SIGTERM', () => {
  openTelemetrySDK.shutdown().then(
    () => console.info('SDK shutdown successfully'),
    err => console.info('Error shutting down SDK', err),
  )
})

// This must be the first thing that needs to be imported or before the first import of grpc-js happens.
export default openTelemetrySDK

Dependencies

"@opentelemetry/auto-instrumentations-node": "^0.54.0",
    "@opentelemetry/instrumentation": "^0.56.0",
    "@opentelemetry/instrumentation-grpc": "^0.56.0",
    "@opentelemetry/sdk-metrics": "^1.29.0",
    "@opentelemetry/sdk-node": "^0.56.0",
    "@opentelemetry/sdk-trace-node": "^1.29.0",
    "@opentelemetry/resources": "^1.29.0",
    "@opentelemetry/semantic-conventions": "^1.28.0",

And to run my main file, I use the command npx ts-node --require ./src/instrumentation.ts src/greeter_client.ts. if I enable diag DEBUG logging, then I can see all those trace logs containing the grpc status, method, service_name, status_code, etc. However, I am unable to see any histogram type metrics for the continuously fired Unary Call from src/greeter_client.ts.

Next, while searching around for solutions, I stumbled upon this doc https://opentelemetry.io/docs/languages/js/getting-started/nodejs/ and using the suggestion, I only started receiving http instrument metrics but not grpc instrument metrics.

Any idea how I can setup ?

  • [x ] This only affects the JavaScript OpenTelemetry library
  • This may affect other libraries, but I would like to get opinions here first
@pichlermarc
Copy link
Member

Hi @rathsai - metrics for gRPC are curently not implemented yet. Implementation is currently blocked by semantic conventions updates. I created an issue to track this #5250 and the blockers for implementation.

@pichlermarc
Copy link
Member

@rathsai - I'll close this issue as we now have a documented path forward for this feature (#5250) - if there are any additional questions, please feel free to comment over at #5250. Thanks 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants