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

[Bug]: Metric logging is not spec compliant #874

Closed
Jack-Burnett opened this issue Aug 1, 2022 · 4 comments · Fixed by #878
Closed

[Bug]: Metric logging is not spec compliant #874

Jack-Burnett opened this issue Aug 1, 2022 · 4 comments · Fixed by #878

Comments

@Jack-Burnett
Copy link
Contributor

Singer SDK Version

0.6.1

Python Version

3.9

Bug scope

Taps (catalog, state, stream maps, etc.)

Operating System

MacOS

Description

A metric log looks like this:
time=2022-08-01 16:19:29 name=tap-tabular-sftp level=INFO message=INFO METRIC: {'type': 'counter', 'metric': 'record_count', 'value': 0, 'tags': {'stream': 'test'}}

The issue is that it uses ' instead of " so is not valid JSON that other tools would be able to parse.

I think this line:

self._metric_logging_function(f"INFO METRIC: {str(metric)}")

would simple need to be changed to a json dump instead of directly trying to log the object.

As is, it is not compliant with the spec at https://hub.meltano.com/singer/spec#metrics

Code

No response

@edgarrmondragon
Copy link
Collaborator

@Jack-Burnett thanks for filing! I agree. The issue is str is being used instead of json.dumps to cast the metric.

It's an easy fix. Would you have the time and be willing to submit a PR?

@Jack-Burnett
Copy link
Contributor Author

Sure thing

@Jack-Burnett
Copy link
Contributor Author

Jack-Burnett commented Aug 1, 2022

Sorry if this is a silly question, but do I need to do something to be able to make a PR?
After creating a branch and then attempting to run;
git push --set-upstream origin fix_metric_format
I get back
remote: Permission to meltano/sdk.git denied to Jack-Burnett. fatal: unable to access 'https://github.com/meltano/sdk.git/': The requested URL returned error: 403

@edgarrmondragon
Copy link
Collaborator

edgarrmondragon commented Aug 2, 2022

@Jack-Burnett Ah, you need to fork this repository, commit the changes to the patch branch in your personal fork, and then submit a PR from your fork to the main branch in this repo. Let me know if I can help with any step of the process 🙂.

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

Successfully merging a pull request may close this issue.

2 participants