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

Inconsistency across OTEL_EXPORTER_OTLP_SPAN_ENDPOINT configuration #18

Closed
jonathanbeber opened this issue Sep 11, 2020 · 1 comment
Closed

Comments

@jonathanbeber
Copy link

Hello, there,

Describe the bug

I'm not very sure that's a bug, but for me, it's the closest definition to this issue.

When following the lightstep quick start docs, there's an inconsistency regarding the value to be set for OTEL_EXPORTER_OTLP_SPAN_ENDPOINT. In the Java and Python it works as described by the doc, but this project, the NodeJS launcher, requires the full URI.

To Reproduce

I'm running a docker-compose inspired on the great project @codeboten and @carlosalberto put together to the KubeCon. The relevant part of my config is the following:

docker-compose.yaml
# Copyright Lightstep Authors
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: "3.7"
services:
  nodejs-server:
    build: ./nodejs-server
    environment:
      - OTEL_EXPORTER_OTLP_SPAN_ENDPOINT=lightstep-satellite:8360
      - OTEL_EXPORTER_OTLP_SPAN_INSECURE=true
      - OTEL_LOG_LEVEL=debug
      - LS_SERVICE_NAME=nodejs-server
    networks:
      - demo
    ports:
      - "0.0.0.0:8083:8083" # NodeJS server port
    depends_on:
      - lightstep-satellite
    stop_grace_period: 1s
  lightstep-satellite:
    container_name: lightstep-satellite
    image: lightstep/developer-satellite
    networks:
      - demo
    environment:
      - COLLECTOR_ADMIN_PLAIN_PORT=8361
      - COLLECTOR_ADMIN_SECURE_PORT=0
      - COLLECTOR_API_KEY=MyLSKey
      - COLLECTOR_BABYSITTER_PORT=0
      - COLLECTOR_DISABLE_ACCESS_TOKEN_CHECKING=true
      - COLLECTOR_ENABLE_META_EVENTS=false
      - COLLECTOR_FORWARDED_TAGS=developer_satellite=true
      - COLLECTOR_GRPC_MAX_MSG_SIZE_BYTES=16777216
      - COLLECTOR_GRPC_PLAIN_PORT=0
      - COLLECTOR_HTTP_PLAIN_PORT=8360
      - COLLECTOR_LOGGING_STDERR_CONFIG_ENABLED=true
      - COLLECTOR_LOGGING_STDERR_CONFIG_FORMAT_HIDE_CALLSTACK=true
      - COLLECTOR_LOGGING_STDERR_CONFIG_FORMAT_HIDE_TAGS=true
      - COLLECTOR_PLAIN_PORT=0
      - COLLECTOR_POOL=developer-satellite
      - COLLECTOR_PROJECT_NAME=CollectorProjectName
      - COLLECTOR_REPORTER_BYTES_PER_PROJECT=100000000
      - COLLECTOR_ROUTING_TAGS=developer_name:jonathan.juares.beber@zalando.de,project_name:MyProject,developer_mode:true
    ports:
      - "0.0.0.0:8361:8361"
      - "0.0.0.0:8360:8360"
networks:
  demo:

And then inside ./nodejs-server:

server.js
'use strict';

const { lightstep, opentelemetry } = require("lightstep-opentelemetry-launcher-node");

const PORT = process.env.PORT || 8083;

const sdk = lightstep.configureOpenTelemetry({});

sdk.start().then(() => {
    const express = require('express');
    const app = express();
    app.use(express.json());

    app.get('/', (req, res) => {

        res.send('running...');
    });

    app.get('/ping', (req, res) => {
        console.log(req.rawHeaders);
        res.send('pong');
    });

    app.listen(PORT);
    console.log(`Running on ${PORT}`);

    // opentelemetry.trace.getTracerProvider().getActiveSpanProcessor().shutdown();
});
package.json
{
    "name": "server",
    "version": "1.0.0",
    "description": "",
    "main": "server.js",
    "scripts": {
        "start": "node server.js",
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        "express": "^4.17.1",
        "lightstep-opentelemetry-launcher-node": "^0.10.3",
        "@opentelemetry/plugins-node-all": "^0.11"
    }
}
Dockerfile
FROM node:14

# Create app directory
WORKDIR /usr/src/server

# Install app dependencies
COPY package*.json ./
RUN npm install

# Bundle app source
COPY . .

EXPOSE 8080
CMD [ "node", "server.js" ]

Expected behavior

There are two expected behaviours for me here:

  1. I'd expect it to work. As I mentioned before the Java and Python launchers work with this config. For the NodeJS launcher, I had to use OTEL_EXPORTER_OTLP_SPAN_ENDPOINT=http://lightstep-satellite:8360/api/v2/otel/trace. I saw it was already kind of discussed here, but this discussion had no conclusion.

  2. I put the agent in debug mode (OTEL_LOG_LEVEL=debug) and it failed silently. No errors were returned due to my "wrong" configuration. I'd expect it to tell me it failed to delivery the span (here I'm not sure where the problem is, I see I can make any request to the developer mode satellite and it always returns ok, maybe, that's the problem?!)

Additional context

I'm using a local satellite (developer mode).

@kayousterhout kayousterhout assigned obecny and unassigned obecny Sep 13, 2020
@kayousterhout
Copy link

Thanks for reporting this - the inconsistency here is because Node.js reports spans using JSON over HTTP, and the HTTP destination includes a path. We've updated the quick start guides to say this.

For the second issue, there are some historical reasons why we always returned "ok" but those no longer hold and there are currently some internal efforts to update this. Closing this ticket because the "ok" issue is tracked separately in our internal codebase.

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

3 participants