GoogleCloudPlatform / GoogleCloudPlatform/opentelemetry-operations-python

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

Aperta
#255 5 commenti 1 reazione 1 assegnatario Rivendicata da @aabmass Vedi su GitHub
priority: p2 question
Lingua principale
Python
Stelle
83
Fork
46
Merge medio
11h 40m
PR unite (30g)
2

Descrizione

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 ?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.