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

[receiver/prometheus] Can a collector with prometheusreceiver receive data from a Prometheus server? #31408

Closed
mariana-mendes opened this issue Feb 26, 2024 · 4 comments
Assignees
Labels
question Further information is requested receiver/prometheus Prometheus receiver Stale

Comments

@mariana-mendes
Copy link

Component(s)

receiver/prometheus

Describe the issue you're reporting

Hello!
It is not clear to me if it's possible to use the following strategy to get metrics:

apps --> Prometheus server scraping metrics --> otel-collector with a prometheus receiver.
I've tried with the following configs:

my prometheus.yaml config:

...

    remoteWrite:
      - url:  https://<MY-OTEL-HOST-http>/v1/metrics


  # Prometheus scrape configs - start
  serverFiles:
    prometheus.yml:
      scrape_configs:
        - job_name: prometheus
          honor_labels: true
          honor_timestamps: true
          static_configs:
            - targets:
                - localhost:9090

...
        

my collector.yaml config:


istio:
  endpoints:
    - name: grpc-otlp
      port: 4327
      hosts:
        - <MY-OTEL-HOST-grpc>
      gateways:
        - istio-system/internal-gateway
    - name: otlp-http
      port: 4318
      hosts:
        - <MY-OTEL-HOST-http>
      gateways:
        - istio-system/internal-gateway


opentelemetry-collector:
...

  config:
    receivers:
      otlp:
        protocols:
          http:
            endpoint: 0.0.0.0:4318
      prometheus:
        config:
          scrape_configs:
            - job_name: prometheus
              honor_labels: true
              honor_timestamps: true
              static_configs:
              - targets:
                  - localhost:9090

    exporters:
      prometheusremotewrite:
        endpoint: http://<ENDPOINT-TO-MYDATA-SINK>/insert/0/prometheus/
 

      logging:
        verbosity: basic
        sampling_initial: 10
        sampling_thereafter: 1000

    processors:
...
    


...
      pipelines:
        logs: null
        metrics:
          receivers:
            - otlp
            - prometheus
          processors:
            - memory_limiter
            - batch
          exporters:
            - prometheusremotewrite
            - logging
        traces: null

The data is not reaching the collector, and in the Prometheus server logs, I'm getting the following error:

ts=2024-02-23T14:32:28.107Z caller=dedupe.go:112 component=remote level=error remote_name=4d846f url=http://<MY-OTEL-HOST-http>/v1/metrics msg=“non-recoverable error” count=11 exemplarCount=0 err=“server returned HTTP status 400 Bad Request: \u0008\u0003\u0012$unsupported Content-Encoding: snappy”

I'd like to know if I need to include something in the configuration or if it's really not possible.

Thank you!! 🤗

@mariana-mendes mariana-mendes added the needs triage New item requiring triage label Feb 26, 2024
@github-actions github-actions bot added the receiver/prometheus Prometheus receiver label Feb 26, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@mariana-mendes mariana-mendes changed the title Can a collector with prometheusreceiver receive data from a Prometheus server? [receiver/prometheus] Can a collector with prometheusreceiver receive data from a Prometheus server? Feb 26, 2024
@dashpole
Copy link
Contributor

It looks like you are trying to write the prometheus remote write protocol to the OTLP receiver, which will not work since they are different protocols. The only way i'm aware of doing this today is to use the prometheus receiver and scrape the federated endpoint of the prometheus server. You will need to set honor_labels: true in the prometheus receiver config.

There is no prometheus remote write receiver at the moment.

@dashpole dashpole removed the needs triage New item requiring triage label Feb 26, 2024
@dashpole dashpole self-assigned this Feb 26, 2024
@crobert-1 crobert-1 added the question Further information is requested label Feb 26, 2024
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Apr 29, 2024
@dashpole
Copy link
Contributor

Feel free to reopen if you have further questions. The #otel-collector channel on slack is also a good place for questions like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested receiver/prometheus Prometheus receiver Stale
Projects
None yet
Development

No branches or pull requests

3 participants