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

Instrumentation scope not present in Metric stream #31028

Closed
cwegener opened this issue Feb 5, 2024 · 4 comments · Fixed by #36812
Closed

Instrumentation scope not present in Metric stream #31028

cwegener opened this issue Feb 5, 2024 · 4 comments · Fixed by #36812
Labels
bug Something isn't working never stale Issues marked with this label will be never staled and automatically removed priority:p2 Medium receiver/sqlquery SQL query receiver

Comments

@cwegener
Copy link
Contributor

cwegener commented Feb 5, 2024

Component(s)

receiver/sqlquery

What happened?

Description

The Instrumentation Scope is not being set to the expected value (i.e. otelcol/sqlqueryreceiver) in the Metric streams that are generated from the sqlqueryreceiver.

Steps to Reproduce

  1. Download otelcol-contrib v0.93.0 or earlier
  2. Run collector with the provided sample configuration
  3. Observe the Metrics stream produced on stdout

Expected Result

The Instrumentation Scope should show otelcol/sqlqueryreceiver

Actual Result

The Instrumentation Scope is empty

Collector version

v0.93.0

Environment information

Environment

OS: Ubuntu 22.04,

OpenTelemetry Collector configuration

receivers:
  sqlquery/test:
    driver: postgres
    collection_interval: 60s
    datasource: "postgres://user:password@/database?sslmode=disable"
    queries:
      - sql: |
          select now() as "timestamp", 1 as "metric"

        metrics:
          - metric_name: testmetric
            value_column: metric
            value_type: int
            data_type: gauge
            unit: "1"

exporters:
  logging:
    verbosity: detailed

service:
  pipelines:
    metrics:
      receivers:
        - sqlquery/test
      processors: []
      exporters:
        - logging

Log output

2024-02-05T17:55:10.631+1100    info    [email protected]/telemetry.go:76 Setting up own telemetry...
2024-02-05T17:55:10.631+1100    info    [email protected]/telemetry.go:146        Serving metrics {"address": ":8888", "level": "Basic"}
2024-02-05T17:55:10.631+1100    info    [email protected]/exporter.go:275        Deprecated component. Will be removed in future releases.       {"kind": "exporter", "data_type": "metrics", "name": "logging"}
2024-02-05T17:55:10.632+1100    info    [email protected]/service.go:139  Starting otelcol-contrib...     {"Version": "0.93.0", "NumCPU": 16}                                                                                                                    2024-02-05T17:55:10.632+1100    info    extensions/extensions.go:34     Starting extensions...                                                                                                                                                                 2024-02-05T17:55:10.632+1100    info    [email protected]/service.go:165  Everything is ready. Begin running and processing data.
2024-02-05T17:55:11.641+1100    info    MetricsExporter {"kind": "exporter", "data_type": "metrics", "name": "logging", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-02-05T17:55:11.641+1100    info    ResourceMetrics #0
Resource SchemaURL:
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
     -> Name: testmetric
     -> Description:
     -> Unit: 1
     -> DataType: Gauge
NumberDataPoints #0
StartTimestamp: 1970-01-01 00:00:00 +0000 UTC
Timestamp: 2024-02-05 06:55:11.641453691 +0000 UTC
Value: 1
        {"kind": "exporter", "data_type": "metrics", "name": "logging"}
^C2024-02-05T17:55:13.613+1100  info    [email protected]/collector.go:258        Received signal from OS {"signal": "interrupt"}
2024-02-05T17:55:13.613+1100    info    [email protected]/service.go:179  Starting shutdown...
2024-02-05T17:55:13.614+1100    info    extensions/extensions.go:59     Stopping extensions...
2024-02-05T17:55:13.614+1100    info    [email protected]/service.go:193  Shutdown complete.

Additional context

No response

@cwegener cwegener added bug Something isn't working needs triage New item requiring triage labels Feb 5, 2024
@github-actions github-actions bot added the receiver/sqlquery SQL query receiver label Feb 5, 2024
Copy link
Contributor

github-actions bot commented Feb 5, 2024

Pinging code owners:

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

@crobert-1
Copy link
Member

Thanks for filing @cwegener, I agree this is a valid issue.

As far as solution, we'd want to set the scope name here:

A lot of internal logic of the sqlquery receiver was moved to a separate package so that multiple receivers can use it. Since multiple receivers may be calling the Scrape method, their scope name should be passed to the internal package as an internal config variable, without user configuration. This would allow users to know which receiver the metric is coming from, instead of a single default value.

@crobert-1 crobert-1 added priority:p2 Medium and removed needs triage New item requiring triage labels Feb 9, 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 10, 2024
@crobert-1 crobert-1 removed the Stale label Apr 10, 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 Jun 10, 2024
@crobert-1 crobert-1 added never stale Issues marked with this label will be never staled and automatically removed and removed Stale labels Jun 10, 2024
dmitryax pushed a commit that referenced this issue Dec 18, 2024
…iver metrics & logs (#36812)

#### Description
Add instrumentation scope to the metrics and logs emitted by the
sqlqueryreceiver.

#### Link to tracking issue
Fixes
#31028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working never stale Issues marked with this label will be never staled and automatically removed priority:p2 Medium receiver/sqlquery SQL query receiver
Projects
None yet
2 participants