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

Add dynatrace meter registry for metrics api v2 #2406

Conversation

damass
Copy link

@damass damass commented Jan 13, 2021

Fix #2295 - Adding new implementation (dynatrace2) to make use of Dynatrace Metrics API v2

Copy link
Member

@jonatan-ivanov jonatan-ivanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! :)

I haven't finished reviewing this but would you please merge master back to your branch?
There is a trivial merge conflict and there were some checkstyle changes so this will fail after the merge.

default String entityId() { return getString(this,"entityId").orElse(""); }

default String apiToken() {
if (this.uri().contains("localhost")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is always required for V1, did V1 mandate auth while V2 does not?

import java.util.stream.Stream;
import java.util.stream.StreamSupport;

class Streams {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed, would not calling StreamSupport.stream be ok (the rest of the codebase does that)?
I think if we can agree that dropping the parallel parameter has some value that worth the change, we can do it everywhere but I would do it in a separate PR.


@SpringBootApplication(scanBasePackageClasses = PersonController.class)
@EnableScheduling
public class Dynatrace2Sample {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Spring Boot does not support it, this won't work. I would create the DynatraceMeterRegistry @Bean here.

# limitations under the License.
#

management.metrics.export.dynatrace2:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about the deviceName?

addCommonTags_groupName();
}

private void addCommonTags_groupName() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please do camelCase?

@Override
protected void publish() {
NamingConvention lineProtocolNamingConvention = config().namingConvention();
MetricLineFactory metricLineFactory = new MetricLineFactory(clock, lineProtocolNamingConvention);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a new instance every time?

List<String> metricLinesToSkip = metricLines.get(true);
if (!metricLinesToSkip.isEmpty()) {
logger.warn(
"Dropping {} metric lines because are greater than line protocol max length limit ({}).",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this limit still exist? I did not see it in the docs.

*/
class LineProtocolFormatters {

private static final DecimalFormat METRIC_VALUE_FORMAT = new DecimalFormat(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DecimalFormat is not thread-safe, can it be used by multiple thread?

@jonatan-ivanov
Copy link
Member

Closing in favor of #2581

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

Successfully merging this pull request may close these issues.

Support for Dynatrace metrics API v2
3 participants