This message was deleted.
# ask-for-help
s
This message was deleted.
πŸ†’ 1
s
The plan sounds correct to me. Looking forward to learning the results!
e
Okay, I'm having an issue. (2) I believe was flawed in that we do not need an OpenTelemetry config file. We'd only need that if we were running our own collector, and in this case, NewRelic is the collector. I can't get bento to respect the settings I'm trying to use to send the OTel information to NewRelic. Here's my docker-compose file:
Copy code
version: "3.8"

services:
  bento-service:
    image: dummy-service:latest
    ports:
      - "3000:3000"
    volumes:
      - .:/home/bentoml/bento/src/
      - ./bentoml_configuration.yaml:/home/bentoml/bentoml_configuration.yaml
    command: serve --port 3000 --debug # have tried with --production as well
    environment:
      OTEL_EXPORTER_OTLP_ENDPOINT: <https://otlp.nr-data.net>
      # I've tried enabling/disabling this
      OTEL_EXPORTER_OTLP_HEADERS: api-key=${NEW_RELIC_LICENSE_KEY},service.name=opentelemetry-bento-svc
      BENTO_CONFIG: /home/bentoml/bentoml_configuration.yaml
    env_file:
      - .env
And here's my
bentoml_configuration.yaml
Copy code
version: 1
api_server:
  tracing:
    enabled: true
    exporter_type: otlp
    sample_rate: 1.0
    otlp:
      protocol: grpc
      endpoint: <https://otlp.nr-data.net>
      grpc:
        insecure: false
        headers:
          - ["grpc-encoding", "gzip"]
          - ["api-key", "${NEW_RELIC_LICENSE_KEY}"]
          - ["service.name", "opentelemetry-bento-svc"]
But when I run
docker-compose up
, bentoml gives me this warning
Copy code
[DEBUG] [dev_api_server] 'tracing.sample_rate' is set to zero. No traces will be collected. Please refer to <https://docs.bentoml.org/en/latest/guides/tracing.html> for more details.
Why wouldn't bento be respecting my
bento_configuration.yaml
?
Here's my directory structure:
Copy code
.
β”œβ”€β”€ bentofile.yaml
β”œβ”€β”€ bentoml_configuration.yaml
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ service.py
j
The environment variable for your bento config path should be
BENTOML_CONFIG
instead of
BENTO_CONFIG
e
Hah, that did it! Now it doesn't like the contents of the file, but that's progress πŸ˜„
πŸ‘ 1
j
you can also specify that environment variable in your
bentofile.yaml
, under the
docker.env
key: https://docs.bentoml.org/en/latest/concepts/bento.html#docker-options
e
Oh beautiful 🀩
I'm hot on the NewRelic trail, trying to export traces from a BentoML REST API into NewRelic. When I try to push traces to NewRelic, I get
Copy code
Failed to export traces, error code: StatusCode.PERMISSION_DENIED
And when I remove the API key altogether, I get
Copy code
Failed to export traces, error code: StatusCode.UNAUTHENTICATED
This would seem to indicate that my API key is valid, but somehow doesn't have permission to push traces to NewRelic. I think it's a license key. Any idea how I might troubleshoot this? This key is of type
LICENSE
j
I regret that I won't be much help in that regard...I haven't used New Relic in years
it might be the Key Type though. It looks like a User Key might be read-only
e
Oh no worries, I'm using this thread generally to book keep the progress on this, I wasn't directing this at you specifically πŸ˜…
j
Gotcha πŸ™‚
e
For completeness, this is the context of the message:
Copy code
dummy-service-bento-service-1  | 2023-03-17T20:06:44+0000 [INFO] [dev_api_server] 172.22.0.1:59704 - "POST /predict HTTP/1.1" 200 (trace=e7fde7960a744d368c34896b26d3544c,span=1b911bcd8e57b82d,sampled=1)
dummy-service-bento-service-1  | 2023-03-17T20:06:44+0000 [INFO] [dev_api_server] 172.22.0.1:59704 (scheme=http,method=POST,path=/predict,type=application/json,length=16) (status=200,type=application/json,length=25) 2068.939ms (trace=e7fde7960a744d368c34896b26d3544c,span=0387ffb4f6eb1d1c,sampled=1)
dummy-service-bento-service-1  | I0317 20:06:44.237912919      39 <http://socket_utils_common_posix.cc:407]|socket_utils_common_posix.cc:407]>     Disabling AF_INET6 sockets because ::1 is not available.
dummy-service-bento-service-1  | 2023-03-17T20:06:44+0000 [ERROR] [dev_api_server] Failed to export traces, error code: StatusCode.PERMISSION_DENIED
I've created a public GitHub repo with this minimal example: https://github.com/phitoduck/bentoml-opentelemetry-newrelic
I opened a support case with NewRelic, linking them to the repo so they can reproduce the problem.
Confirming, NewRelic was able to reproduce the problem and recommended checking back with the BentoML community:
Hello,
Thanks for your patience.
I went over this with our engineers within the OTEL space and unfortunately they are not familiar enough with the BentoML product to advise on how to resolve this. The issue doesn't appear to be related to the license key being invalid, since it was failing with the permission denied message for me as well. The team suggested filing an issue with BentoML as the next step, and letting them know that there is an issue with sending data when authentication is required.
I'm sorry I don't have better news.
I opened this up as a GitHub issue here
For good news, I was able to get BentoML metrics into NewRelic using the OpenTelemetry collector!
otel-config.yml
Copy code
receivers:
  otlp:
    protocols:
      grpc:
      http:
  prometheus:
    config:
      scrape_configs:
        - job_name: bentoml-otel-prom-job
          static_configs:
            - targets: ["${SCRAPE_TARGET}"]
          metrics_path: /metrics
          scrape_interval: 5s
          
          

processors:
  batch:

exporters:
  otlp:
    endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT}
    headers:
      api-key: ${NEW_RELIC_LICENSE_KEY}

service:
  telemetry:
    logs:
      level: "debug"
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlp]
    metrics:
      receivers: [otlp, prometheus]
      processors: [batch]
      exporters: [otlp]
    logs:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlp]
NRQL statement:
Copy code
FROM Log, Metric, Span SELECT count(*) WHERE instrumentation.provider = 'opentelemetry' and newrelic.source = 'api.metrics.otlp' facet  entity.name , service.name , newrelic.source    since 30 days ago](<FROM Log, Metric, Span SELECT count(*) WHERE instrumentation.provider = 'opentelemetry' and newrelic.source = 'api.metrics.otlp' facet  entity.name , `entity.guid`, service.name , newrelic.source    since 30 days ago
Result:
That is cool!
Observation: the
otel-collector
and the BentoML service are using the same New Relic license key to. The OtelCollector is pushing metrics directly to NewRelic. The BentoML app is pushing traces directly to NewRelic. (wouldn't be against pushing them directly to the collector) This leads me to believe that the error is due to a configuration issue with my BentoML app or with a bug in the BentoML codebase.