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

Custom metrics didn't indexes #848

Closed
NaorPeretzIonix opened this issue Jan 24, 2024 · 1 comment
Closed

Custom metrics didn't indexes #848

NaorPeretzIonix opened this issue Jan 24, 2024 · 1 comment

Comments

@NaorPeretzIonix
Copy link

NaorPeretzIonix commented Jan 24, 2024

Describe the bug
I send custom metrics using
metric_set.counter(name=task_metrics_name, reset_on_collect=False, labels=labels).inc(value), the metric is on the elastic side but from the dictionary with the fake data:
{'company': 'brightwoodlp', 'scan_frequency': 'Monthly'}
I get this:
image
we are getting just labels.labels and the unparsed dictionary, as I read and know it should be indexed to allow search and more.

To Reproduce
Steps to reproduce the behavior:

  1. I use elastic-apm==6.19.0, python 3.8.10 configuration code:
    def config_elastic_setup_metrics(self, SERVICE_NAME, ENV, ELASTIC_AUTH_TOKEN, METRIC_SET_SUBCLASS: MetricSet,
                                     ELASTICSEARCH_ENDPOINT=MetricsConsts.ELASTICSEARCH_ENDPOINT):
        self.elastic_apm_client = elasticapm.get_client() or elasticapm.Client(
            # Set the server URL
            service_name=SERVICE_NAME,
            server_url=ELASTICSEARCH_ENDPOINT,

            # Set authentication credentials (if needed)
            secret_token=ELASTIC_AUTH_TOKEN,
            environment=ENV,
            # Other configuration options...
        )
        metric_set = self.elastic_apm_client.metrics.register(METRIC_SET_SUBCLASS)
        self.metric_set = metric_set
        return metric_set

then I call:
self.metric_set.counter(name=task_metrics_name, reset_on_collect=False, labels=labels).inc(value)

then I got the APM and searched for the value of task_metrics_name, we don't have any logs about errors but the metric doesn't as we expected

Expected behavior
I expect to get the field names and values:
label.company: "brightwoodlp"
label.scan_frequency: "Monthly"

in exsit format it's more like metadata, unsearchable and unindexed.

Thank you, Naor.

@NaorPeretzIonix
Copy link
Author

when I called:

self.metric_set.counter(name=task_metrics_name, reset_on_collect=False, **labels).inc(value)

I got :
labels.company: tcnewco
labels.scan_frequency: Continuous

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