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

gRPC client methods are not patched correctly #630

Closed
mayurkale22 opened this issue Dec 16, 2019 · 0 comments · Fixed by #631
Closed

gRPC client methods are not patched correctly #630

mayurkale22 opened this issue Dec 16, 2019 · 0 comments · Fixed by #631
Labels
bug Something isn't working
Milestone

Comments

@mayurkale22
Copy link
Member

gRPC client methods are not patched correctly (see below sample code). This may be related to #384.

'use strict';

const { NodeTracer } = require('@opentelemetry/node');
const { SimpleSpanProcessor } = require('@opentelemetry/tracing');
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');
const tracer = new NodeTracer();
const exporter = new JaegerExporter({serviceName: 'otel',});
tracer.addSpanProcessor(new SimpleSpanProcessor(exporter));

const express = require('express');
const app = express();
const {Spanner} = require('@google-cloud/spanner');
const projectId = 'xxx';
const instanceId = 'yyy';
const databaseId = 'zzz';
const spanner = new Spanner({projectId});

// Gets a reference to a Cloud Spanner instance and database
const instance = spanner.instance(instanceId);
const database = instance.database(databaseId);

// This incoming HTTP request should be captured by Trace
app.get('/', async (req, res) => {
  // This outgoing HTTP request should be captured by Trace
  let data = '';
  try {
    const playersTable = database.table('Players');
    const query = {columns: ['email'], keySet: {all: true,},};
    const [rows] = await playersTable.read(query);
    rows.forEach(row => {
      const json = row.toJSON();
      data += json.email + '\n';
    });
    res.status(200).send(data).end();
  }
  catch (err) {
    console.error(err);
    res.status(500).end();
  }
});

// Start the server
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
  console.log(`App listening on port ${PORT}`);
  console.log('Press Ctrl+C to quit.');
});
@mayurkale22 mayurkale22 added the bug Something isn't working label Dec 16, 2019
@mayurkale22 mayurkale22 added this to the Alpha v0.3.1 milestone Dec 17, 2019
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this issue Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant