diff --git a/.fleetControl/agentControl/agent-schema-for-agent-control.yml b/.fleetControl/agentControl/agent-schema-for-agent-control.yml new file mode 100644 index 0000000000..b93dc578e7 --- /dev/null +++ b/.fleetControl/agentControl/agent-schema-for-agent-control.yml @@ -0,0 +1,61 @@ +namespace: newrelic +name: com.newrelic.apm_java +version: 0.1.0 +variables: + k8s: + version: + description: "Java Agent init container version" + type: string + default: "latest" + required: false + podLabelSelector: + description: "Pod label selector" + type: yaml + default: { } + required: false + namespaceLabelSelector: + description: "Namespace label selector" + type: yaml + default: { } + required: false + env: + description: "environment variables to pass to Java agent" + type: yaml + default: [ ] + required: false + health_env: + description: "environment variables to pass to health sidecar" + type: yaml + default: [ ] + required: false + health_version: + description: "health sidecar image version" + type: string + default: "latest" + required: false +deployment: + k8s: + health: + interval: 30s + initial_delay: 30s + objects: + instrumentation: + apiVersion: newrelic.com/v1beta1 + kind: Instrumentation + metadata: + name: ${nr-sub:agent_id} + # APM CRs should be installed in "nr-ac:namespace" + # Due to a limitation in the k8s-agents-operator, Instrumentation CRs must be installed in the same namespace as the operator. + # Hence, the namespace is set to "nr-ac:namespace_agents". + # Reference: https://github.com/newrelic/k8s-agents-operator/blob/92c19208864f051f03f457ee04b772fca5042162/api/v1beta1/instrumentation_webhook.go#L110C27-L110C72 + namespace: ${nr-ac:namespace_agents} + spec: + agent: + language: java + image: newrelic/newrelic-java-init:${nr-var:version} + env: ${nr-var:env} + healthAgent: + image: newrelic/k8s-apm-agent-health-sidecar:${nr-var:health_version} + env: ${nr-var:health_env} + podLabelSelector: ${nr-var:podLabelSelector} + namespaceLabelSelector: ${nr-var:namespaceLabelSelector} diff --git a/.fleetControl/configurationDefinitions.yml b/.fleetControl/configurationDefinitions.yml new file mode 100644 index 0000000000..65c62f291e --- /dev/null +++ b/.fleetControl/configurationDefinitions.yml @@ -0,0 +1,7 @@ +configurationDefinitions: + - platform: ALL + description: java agent configuration description + type: java-config + version: 1.0.0 + format: yml + schema: ./schemas/java-config.json diff --git a/.fleetControl/schemas/java-config.json b/.fleetControl/schemas/java-config.json new file mode 100644 index 0000000000..5f0de07418 --- /dev/null +++ b/.fleetControl/schemas/java-config.json @@ -0,0 +1,402 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://newrelic.com/schemas/java-agent-configuration.json", + "title": "New Relic Java Agent Configuration Schema", + "version": "1.0.0", + "description": "Schema for New Relic Java agent configuration (newrelic.yml)", + "type": "object", + "properties": { + "common": { + "type": "object", + "description": "Common configuration settings shared across all environments", + "properties": { + "license_key": { + "type": "string", + "minLength": 1, + "description": "New Relic license key", + "examples": ["<%= license_key %>", "your_license_key_here"] + }, + "agent_enabled": { + "type": "boolean", + "description": "Enable or disable the agent", + "default": true + }, + "app_name": { + "oneOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + }, + "minItems": 1 + } + ], + "description": "Application name(s) as they will appear in New Relic", + "examples": ["My Application", ["My App", "My App Staging"]] + }, + "high_security": { + "type": "boolean", + "description": "Enable high security mode", + "default": false + }, + "log_level": { + "type": "string", + "enum": ["off", "severe", "warning", "info", "fine", "finer", "finest"], + "description": "Log level for the agent", + "default": "info" + }, + "audit_mode": { + "type": "boolean", + "description": "Enable audit mode for debugging", + "default": false + }, + "log_file_name": { + "type": "string", + "description": "Name of the log file", + "default": "newrelic_agent.log" + }, + "log_limit_in_kbytes": { + "type": "integer", + "minimum": 0, + "description": "Maximum size of log file in kilobytes", + "default": 0 + }, + "log_daily": { + "type": "boolean", + "description": "Enable daily log rotation", + "default": false + }, + "proxy_host": { + "type": "string", + "description": "Proxy server hostname" + }, + "proxy_port": { + "type": "integer", + "minimum": 1, + "maximum": 65535, + "description": "Proxy server port" + }, + "proxy_user": { + "type": "string", + "description": "Proxy authentication username" + }, + "proxy_password": { + "type": "string", + "description": "Proxy authentication password" + }, + "capture_params": { + "type": "boolean", + "description": "Capture HTTP request parameters", + "default": false + }, + "ignored_params": { + "type": "string", + "description": "Comma-separated list of HTTP parameters to ignore" + }, + "error_collector": { + "type": "object", + "description": "Error collection configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable error collection", + "default": true + }, + "capture_source": { + "type": "boolean", + "description": "Capture source code in error traces", + "default": false + }, + "ignore_errors": { + "type": "string", + "description": "Comma-separated list of exception classes to ignore" + }, + "ignore_classes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of exception classes to ignore" + }, + "ignore_status_codes": { + "type": "string", + "description": "Comma-separated list of HTTP status codes to ignore" + } + }, + "additionalProperties": false + }, + "transaction_tracer": { + "type": "object", + "description": "Transaction tracer configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable transaction tracing", + "default": true + }, + "transaction_threshold": { + "oneOf": [ + { + "type": "string", + "enum": ["apdex_f"] + }, + { + "type": "number", + "minimum": 0 + } + ], + "description": "Threshold for transaction traces (seconds or 'apdex_f')", + "default": "apdex_f" + }, + "record_sql": { + "type": "string", + "enum": ["off", "obfuscated", "raw"], + "description": "SQL recording mode", + "default": "obfuscated" + }, + "explain_enabled": { + "type": "boolean", + "description": "Enable SQL explain plans", + "default": true + }, + "explain_threshold": { + "type": "number", + "minimum": 0, + "description": "Threshold for SQL explain plans (seconds)", + "default": 0.5 + }, + "stack_trace_threshold": { + "type": "number", + "minimum": 0, + "description": "Threshold for stack traces (seconds)", + "default": 0.5 + }, + "slow_query_threshold": { + "type": "number", + "minimum": 0, + "description": "Threshold for slow query traces (seconds)", + "default": 2.0 + } + }, + "additionalProperties": false + }, + "cross_application_tracer": { + "type": "object", + "description": "Cross application tracing configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable cross application tracing", + "default": true + } + }, + "additionalProperties": false + }, + "thread_profiler": { + "type": "object", + "description": "Thread profiler configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable thread profiling", + "default": true + } + }, + "additionalProperties": false + }, + "browser_monitoring": { + "type": "object", + "description": "Real User Monitoring (RUM) configuration", + "properties": { + "auto_instrument": { + "type": "boolean", + "description": "Enable automatic RUM injection", + "default": true + } + }, + "additionalProperties": false + }, + "class_transformer": { + "type": "object", + "description": "Class transformation configuration", + "properties": { + "com.newrelic.instrumentation.servlet-user": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "com.newrelic.instrumentation.spring-aop-2": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "labels": { + "type": "string", + "description": "Semicolon-separated list of key:value labels", + "examples": ["Server:One;Data Center:Primary"] + }, + "attributes": { + "type": "object", + "description": "Attribute configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable attribute collection", + "default": true + }, + "include": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of attributes to include" + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of attributes to exclude" + } + }, + "additionalProperties": false + }, + "distributed_tracing": { + "type": "object", + "description": "Distributed tracing configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable distributed tracing", + "default": false + } + }, + "additionalProperties": false + }, + "span_events": { + "type": "object", + "description": "Span events configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable span events", + "default": true + }, + "max_samples_stored": { + "type": "integer", + "minimum": 0, + "description": "Maximum number of span events to store", + "default": 2000 + } + }, + "additionalProperties": false + }, + "application_logging": { + "type": "object", + "description": "Application logging configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable application logging features", + "default": true + }, + "forwarding": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable log forwarding", + "default": true + }, + "max_samples_stored": { + "type": "integer", + "minimum": 0, + "description": "Maximum number of log events to store", + "default": 10000 + } + }, + "additionalProperties": false + }, + "metrics": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable logging metrics", + "default": true + } + }, + "additionalProperties": false + }, + "local_decorating": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "Enable local log decoration", + "default": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "required": ["license_key", "app_name"], + "additionalProperties": false + }, + "development": { + "type": "object", + "description": "Development environment specific configuration", + "additionalProperties": true + }, + "test": { + "type": "object", + "description": "Test environment specific configuration", + "additionalProperties": true + }, + "production": { + "type": "object", + "description": "Production environment specific configuration", + "additionalProperties": true + }, + "staging": { + "type": "object", + "description": "Staging environment specific configuration", + "additionalProperties": true + } + }, + "required": ["common"], + "additionalProperties": { + "type": "object", + "description": "Custom environment configuration", + "additionalProperties": true + } +} diff --git a/.github/workflows/test-action-workflow.yml b/.github/workflows/test-action-workflow.yml new file mode 100644 index 0000000000..da18fe0cef --- /dev/null +++ b/.github/workflows/test-action-workflow.yml @@ -0,0 +1,52 @@ +name: test-action-workflow.yml + +permissions: + contents: write + +on: + push: + branches: [ 'mvick/test-action' ] + +jobs: + setup-test-tag: + name: Setup Test Tag + runs-on: ubuntu-latest + steps: + - name: Checkout action repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Push temporary tag for testing + run: | + git config user.name "github-actions" + git config user.email "github-actions@github.com" + git tag -f v0.0.0 HEAD + git push -f origin v0.0.0 + + test-agent-metadata-action: + runs-on: ubuntu-latest + steps: + - name: Run action + uses: newrelic/agent-metadata-action@v0.0.8 + with: + newrelic-client-id: ${{ secrets.FC_SYS_ID_CLIENT_ID }} + newrelic-private-key: ${{ secrets.FC_SYS_ID_PR_KEY }} + agent-type: "java" + version: "0.0.0" + cache: false + + cleanup-test-tag: + name: Cleanup Test Tag + runs-on: ubuntu-latest + needs: [test-agent-metadata-action] + if: always() + steps: + - name: Checkout action repository + uses: actions/checkout@v4 + + - name: Delete temporary tag + run: | + git config user.name "github-actions" + git config user.email "github-actions@github.com" + git push origin :refs/tags/v0.0.0 || true