GoogleCloudPlatform / GoogleCloudPlatform/opentelemetry-operations-python

Getting `Duplicate TimeSeries encountered` error logs on sending opentelemtry measures and empty resources info

Open
#255 5 comments 1 reaction 1 assignee Claimed by @aabmass View on GitHub
priority: p2 question
Dominant language
Python
Stars
83
Forks
46
Avg merge
11h 40m
Merged PRs (30d)
2

Description

Hi.
Running kubeflow pipeline on google cloud with python package using these:

```
opentelemetry-api>=1.18.0,
opentelemetry-sdk>=1.18.0,
opentelemetry_resourcedetector_process>=0.3.0'
opentelemetry-propagator-gcp>=1.5.0,
opentelemetry-resourcedetector-gcp>=1.5.0a0,
opentelemetry-exporter-gcp-monitoring>=1.5.0a0,
opentelemetry_resourcedetector_kubernetes>=0.3.0
```

1. I'm getting an opentelemtry error: `One or more TimeSeries could not be written: Field timeSeries[3] had an invalid value: Duplicate TimeSeries encountered. Only one point can be written per TimeSeries per request.; Field timeSeries[1] had an invalid value: Duplicate TimeSeries encountered. Only one point can be written per TimeSeries per request.`
2. I don't see any resource info regarding my metric on google cloud metric explorer

I'm init my metrics as follows:
```
__resources = get_aggregated_resources(
[
KubernetesResourceDetector(),
GoogleCloudResourceDetector(),
ProcessResourceDetector(),
],
timeout=60,
)

metrics.set_meter_provider(
meterProvider(
views=[
view.View(
instrument_name='*.duration',
aggregation=__view.ExplicitBucketHistogramAggregation((
0, 25, 50, 75, 100, 200, 400, 600, 800, 1000, 2000,
4000, 6000, 10000, 20000, 30000, 60000, 120000))
)
],
metric_readers=[
PeriodicExportingMetricReader(
CloudMonitoringMetricsExporter(
add_unique_identifier=True,
prefix='custom.googleapis.com/companyName/my-shared-libary',
),
),
],
resource=__resources
)
)

counter=metrics.get_meter('MeterName').create_counter(name='counter_metric_name', unit='1')
hist=metrics.get_meter('MeterName').create_histogram(name='hist_metric_name',unit='ms')
```

And sending metrics as follows:
```
labels={'product':'productA','status':'OK'}
counter.add(1, labels)
duration = round((datetime.now() - startTime).total_seconds() * 1000)
hist.record(duration, labels)

```

The measure seems ok on the google cloud metric explorer but I wonder why I see this error on logs and why I don't see the resources data there, any idea ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.