Skip to content

Telemetry causing increased memory usage even when disabled #235

@rhamzeh

Description

@rhamzeh

Is there a proper way to disable the Telemetry? The memory of my service increases over time and the investigation lead to the telemetry. When setting Telemetry config to nil (aka using default telemetry)

Showing nodes accounting for 53.54MB, 100% of 53.54MB total
Showing top 10 nodes out of 61

      flat  flat%   sum%        cum   cum%
   23.50MB 43.89% 43.89%    23.50MB 43.89%  github.com/openfga/go-sdk/telemetry.DefaultTelemetryConfiguration
   14.50MB 27.09% 70.98%    14.50MB 27.09%  github.com/openfga/go-sdk/telemetry.(*Metrics).GetHistogram
   10.50MB 19.61% 90.59%    10.50MB 19.61%  github.com/openfga/go-sdk/telemetry.Configure
    2.04MB  3.80% 94.39%    12.54MB 23.41%  github.com/openfga/go-sdk/telemetry.Get</div>

After disabling telemetry, we notice that it is still causing memory increase:
After about an 2 hours of my process running, I am seeing this when I examine pprof. It was not there for the longest time, and now I see it increasing again.

fgaClient, err := client.NewSdkClient(&client.ClientConfiguration{
	ApiUrl: openfgaUrl,

	Telemetry: &telemetry.Configuration{
		Metrics: &telemetry.MetricsConfiguration{},
	},

	Credentials: &credentials.Credentials{
		Method: credentials.CredentialsMethodApiToken,
		Config: &credentials.Config{
			ApiToken: openfgaToken,
		},
	},
})
512.14kB 25.00% 25.00% 512.14kB 25.00% github.com/openfga/go-sdk/telemetry.(*Metrics).GetHistogram
1024.28kB 33.34% 33.34% 1024.28kB 33.34% github.com/openfga/go-sdk/telemetry.(*Metrics).GetHistogram
Showing top 10 nodes out of 54
flat flat% sum% cum cum%
2048.56kB 33.24% 33.24% 2048.56kB 33.24% github.com/openfga/go-sdk/telemetry.(*Metrics).GetHistogram
1042.10kB 16.91% 50.15% 2066.14kB 33.53% github.com/openfga/go-sdk/telemetry.Get
1024.04kB 16.62% 66.77% 1024.04kB 16.62% github.com/openfga/go-sdk/telemetry.Configure

References

Originally reported by @keitherw on September 15, 2025 and discussed in https://github.com/orgs/openfga/discussions/497

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Intake

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions