Skip to content

Instantly share code, notes, and snippets.

@golonzovsky
Last active March 16, 2018 13:47
Show Gist options
  • Save golonzovsky/70c82b154a90887c022a267319b69f6f to your computer and use it in GitHub Desktop.
Save golonzovsky/70c82b154a90887c022a267319b69f6f to your computer and use it in GitHub Desktop.
ES jaeger analytical queries

top services

POST http://{{es}}/jaeger-span-2018-03-15/_search

{
 "size": 0,
 "aggs": {
  "uniq_host": {
  "terms": {
  "field": "process.serviceName",
  "size": 500
  }
  }
 }
}

top operations for an app

POST http://{{es}}/jaeger-span-2018-03-15/_search

{
 "size": 0,
 "aggs": {
	"uniq_host": {
		"terms": {
			"field": "operationName",
			"size": 500
	}
  }
 },
 "query": {
    "bool": {
      "must": [
	    {"term": { "process.serviceName": "sales-butler" }}
	  ]
    }
 }
}

filter post spans for an app

POST http://{{es}}/jaeger-span-2018-03-15/_search

{
  "query": {
    "bool": {
      "must": [
        {"match": {"process.serviceName": {"query": "user-history"}}},
        {
          "nested": {
            "path": "tags",
            "query": {
              "bool": {
                "must": [
                  {"match": {"tags.key": {"query": "http.method"}}},
                  {"match": {"tags.value": {"query": "POST"}}}
                ]
              }
            }
          }
        }
      ]
    }
  },
  "size": 10
}

top post operations

POST http://{{es}}/jaeger-span-2018-03-12/_search

{
 "size": 0,
 "aggs": {
	"uniq_host": {
		"terms": {
			"field": "operationName",
			"size": 500
	}
  }
 },
 "query": {
    "bool": {
      "must": [
	    {"term": { "process.serviceName": "user-history" }},
         {
          "nested": {
            "path": "tags",
            "query": {
              "bool": {
                "must": [
                  {"match": {"tags.key": {"query": "http.method"}}},
                  {"match": {"tags.value": {"query": "POST"}}}
                ]
              }
            }
          }
        }
	  ]
    }
 }
}

(DANGER) delete healthchecks

POST http://{{es}}/jaeger-span-2018-03-16/_delete_by_query

{
  "query": {
    "bool": {
      "must": [
        {"match": {"process.serviceName": {"query": "beta-conflux-integrations"}}},
        {
          "nested": {
            "path": "tags",
            "query": {
              "bool": {
                "must": [
                  {"match": {"tags.key": {"query": "http.path"}}},
                  {"match": {"tags.value": {"query": "/health"}}}
                ]
              }
            }
          }
        }
      ]
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment