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 support to publish traces, metrics from Enforcer to App Insights #2212

Merged
merged 47 commits into from
Sep 28, 2021

Conversation

Vathsan
Copy link
Contributor

@Vathsan Vathsan commented Sep 1, 2021

Purpose

This PR adds support to publish traces and metrics from Enforcer to Azure App Insights.

Traces are generated using Open-telemetry and then published to App Insights using AzureOpenTelemetry exporter. Azure standalone Java agent is configured to publish standard, custom metrics.

Related configurations: https://docs.google.com/document/d/19n5_3NcNY9zdBJi_mQkCYezkOtoLd4gkU0fH0RusyLc/edit?usp=sharing
PoC document: https://docs.google.com/document/d/1te1PQJZdTV-i6dXh_GG0e_hwyVZ_Zxlii3gAHxW6O2M/edit?usp=sharing
Usecases: https://docs.google.com/document/d/1TQkwmbsK8MwtQ52u9wvOdNG7fgpEl55r4qc6xHFEMM8/edit?usp=sharing

ToDos,

  1. Add applicationinsights.json file and applicationinsights-agent-3.1.1.jar to control plane
  2. Update config.toml file (enable metrics, tracing), enforcer dockerfile (update Instrumentation key, path to the agent jar under java opts)

Issues

Partially fixes #2234

Automation tests

  • Unit tests added: No
  • Integration tests added: No

Tested environments

Mac OS, JDK 11


Maintainers: Check before merge

  • Assigned 'Type' label
  • Assigned the project
  • Validated respective github issues
  • Assigned milestone to the github issue(s)

Vathsan and others added 30 commits August 23, 2021 13:37
Add cors and oauth filter tracing
Add latency values to metrics
Add synchronization for AzureTraceExporter
enforcer/pom.xml Outdated Show resolved Hide resolved

CMD java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="${ENFORCER_HOME}/logs/heap-dump.hprof" $JAVA_OPTS -Dlog4j.configurationFile="${ENFORCER_HOME}/conf/log4j2.properties" -cp "lib/*:lib/dropins/*" org.wso2.choreo.connect.enforcer.server.AuthServer

CMD java -javaagent:/home/wso2/conf/applicationinsights-agent-3.1.1.jar -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="${ENFORCER_HOME}/logs/heap-dump.hprof" $JAVA_OPTS -Dlog4j.configurationFile="${ENFORCER_HOME}/conf/log4j2.properties" -DtracingEnabled="true" -cp "lib/*:lib/dropins/*" org.wso2.choreo.connect.enforcer.server.AuthServer
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we place this in lib directory (rather than using conf dir)? @Rajith90 wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah since we are asking to mount the entire lib directory (due to the way lib directory provided in docker compose file), I think we may need some other directory here.

Copy link
Contributor

Choose a reason for hiding this comment

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

btw applicationinsights-agent-3.1.1.jar jar is comitted to the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to decide on placing the agent jar and mounting the applicationinsights.json file. I have removed this JVM arg and added a todo section in the dockerfile to track this. For tracking purposes I have commited the agent jar and its config file with this PR. It should not be an issue as we do not pack either the jar or the config file.

@pubudu538 pubudu538 added this to the 1.0.0-m1 milestone Sep 24, 2021
@pubudu538 pubudu538 linked an issue Sep 27, 2021 that may be closed by this pull request
@pubudu538 pubudu538 modified the milestones: 1.0.0-m2, 1.0.0-m1 Sep 27, 2021
@pubudu538 pubudu538 removed this from the 1.0.0-m1 milestone Sep 27, 2021
Type: "azure",
ConfigProperties: map[string]string{
"connectionString": "",
"instrumentationName": "WSO2-CHOREO",
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we change the default instrumentation name to something more generic that identifies the product.

Suggestion:
CHOREO-CONNECT

Copy link
Contributor

Choose a reason for hiding this comment

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

will be fixed in an upcoming PR

Comment on lines +389 to +408
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-monitor-opentelemetry-exporter</artifactId>
<version>${azure.monitor.opentelemetry.exporter.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-core</artifactId>
<version>${applicationinsights.core.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${enforcer.jackson.databind.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.annotations.version}</version>
</dependency>
Copy link
Contributor

Choose a reason for hiding this comment

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

These dependencies should be defined in root pom's dependencyManagement. Then refered here without the version similar to other dependencies in this pom file

Copy link
Contributor

Choose a reason for hiding this comment

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

will be fixed in an upcoming PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Choreo Connect 1.0.0
  
Awaiting triage
Development

Successfully merging this pull request may close these issues.

Add Open Tracing Support
6 participants