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

Does StableMetric intentionally repeatedly sends old data? #658

Open
JustasL opened this issue Dec 18, 2024 · 0 comments
Open

Does StableMetric intentionally repeatedly sends old data? #658

JustasL opened this issue Dec 18, 2024 · 0 comments

Comments

@JustasL
Copy link

JustasL commented Dec 18, 2024

Does StableMetric intentionally repeatedly sends old data?

I've have very simple setup, and calling counter.add(value: 101, attribute: nil) will send 101 value on repeat as long as the app is alive. If I track more events, the old events will be sent with new ones

I found this by inspecting network request and later placing break point here

Here's my setup:

    let otlpHttpMetricExporter = StableOtlpHTTPMetricExporter(
        endpoint: Constants.metricsAPIURL
    )

    OpenTelemetry.registerStableMeterProvider(
        meterProvider: StableMeterProviderBuilder()
            .setResource(resource: Resource(attributes: [
                "service.name": .string("\(clientName)/ios")
            ]))
            .registerView(
                selector: InstrumentSelector.builder()
                    .setInstrument(name: counterInstrumentName)
                    .setInstrument(type: .counter)
                    .build(),
                view: StableView.builder().build()
            )
            .registerMetricReader(
                reader: StablePeriodicMetricReaderBuilder(exporter: otlpHttpMetricExporter)
                    .setInterval(timeInterval: 5)
                    .build()
            )
            .build()
    )

    meter = OpenTelemetry.instance.stableMeterProvider?
        .meterBuilder(name: "Meter")
        .build()

    var counter = meter?.counterBuilder(name: counterInstrumentName).ofDoubles().build()
        
    counter.add(value: 101, attribute: someAttributes)

I am using 1.12.1 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant